select req.code ,res.code,
case
(
when (req.code==res.code) then 'pass'
when (req.code<>res.code) then 'fail'
/*....2 more case 'when' 'then' statements here*/
end ) result,
req.country ,res.country,
case (when then staments as above)result,
/*.......case stmts upto 70 statemnts*/
from requesttable req full outer join responsetable res on
req.id=res.id
and ....some conditions.
谁能告诉我如何对每一列求和并同时显示总和以及两个表的每一列中的记录数并在我的查询中显示计数?
我的结果应该是这种
code code1 result sum sum1 equivalence country country1 result1 sum sum1
100 100 pass 200000 25000 fail ind aus fail 800000 800000
equivalence
pass
我正在尝试准备一份加入两个表格的报告。我正在使用多个案例语句来完成此操作。我想在一个报告中同时显示两个表的每列的总和和每列的计数。我的查询属于以下类型。