一个查询问题,哪位帮帮忙~~~~
表里有如下数据
cfdh cfsj cfje rjsj
-------------- --------------- --------------------- --------
070107CF000061 2007-01-07 62.0000 20070107
061212CF000122 2006-12-12 35.7000 20061212
061212CF000123 2006-12-12 1.6000 20061212
怎么用一个查询得到如下数据:
cfdh cfsj cfje rjsj
-------------- --------------- --------------------- --------
070107CF000061 2007-01-07 62.0000 20070107
061212CF000122 2006-12-12 35.7000 20061212
061212CF000123 2006-12-12 1.6000 20061212
总金额 null 99.3000 null
------解决方案--------------------select cfdh=case when grouping(cfdh)=1 then '总金额 ' else cfdh end,
max(cfsj) , sum(cfje), max(rjsj)
from ta
group by cfdh with rollup