selectcase when (grouping(glbm)=1) then '合计' else DECODE(glbm,null,'',glbm) end glbm,case when (grouping(hpzl)=1) then '' else DECODE(hpzl,null,'',hpzl) end hpzl,case when (grouping(syxz)=1 and grouping(hpzl)=0) then '小计' else DECODE(syxz,null,'',syx…
可以通过数据绑定来实现 通过union all 来实现数据库 SELECT * FROM v3_pay_list2 where ( (ought_date >= '2012-12-06') and (ought_date <'2013/9/16 0:00:00') and (corp_id = '0001')) union all select 'XXXXXXXXXX', corp_id,dep_id,dep_name,vendor_id,'','', sum(amt),'','',ven…
select then '合计' else cast(姓名 as varchar) end 姓名, then '姓名小计' else cast(学期 as varchar) end 学期, case when cast(学期 as varchar)<>cast('姓名小计' AS varchar) and ISNULL(考次, '') = '' then '学期小计' else 考次 end as 考次, sum(语文) as 语文,sum(数学) as 数学,sum(英语) as 英语,su…