【发布时间】:2023-03-15 11:30:02
【问题描述】:
只需要一些有关 SQL Server 2005 和 Visual Studio 2005 的帮助/建议。
基本上,我有 2 个数据集,一个会产生良好的调用总数,另一个会产生错误的调用数。
我想制作一份报告,显示好到坏的比率。
对于呼叫失败,actstatus 为“105”
SELECT Country, count(status) AS FailedCalls
FROM termactivity(nolock)
INNER JOIN termconfig(NOLOCK) ON cfgterminalID = actterminalID
WHERE actstatus IN (105)
GROUP BY country
ORDER BY country
对于良好的呼叫,actstatus 的单元格中有“5”
SELECT Country, count(status) AS FailedCalls
FROM termactivity(nolock)
INNER JOIN termconfig(NOLOCK) ON cfgterminalID = actterminalID
WHERE actstatus IN (5)
GROUP BY country
ORDER BY country
现在这两个结果都会生成带有国家名称和数字的表格,如下所示
Country fails
AT 240
BE 3
CH 1
CZ 23
DE 5733
ES 336
FR 2
IE 1066
IT 7085
NL 260
NZ 89
PT 790
Country CallSuccess
AT 5662
BE 480
CH 370
CZ 1124
DE 19412
ES 7740
FR 1976
IE 26616
IT 32764
NL 4046
NZ 114
PT 6567
如何将这些添加到一个布局中并最终获得如下表:
Country CallSuccess fails
AT 5662 240
BE 480 10
CH 370 22
CZ 1124 112
DE 19412 888
ES 7740 etc..
FR 1976
IE 26616
IT 32764
NL 4046
NZ 114
PT 6567
【问题讨论】:
标签: sql-server-2005