我的程序是:
create procedure "news"
as
select newsdate,COUNT(B.id) as total from news B
where B.newsyear < GETDATE()
Group by B.newsdate
select newsdate,COUNT(B.id) as total from news B
where B.status='WAITING' and B.cancel='1'
Group by B.newsdate
结果:
newsdate total
2011 4
2010 8
newsdate total
2011 2
2010 3
如何合并年份总计以获得此结果集:
newsdate total
2011 6 {4 + 2}
2010 11 {8 + 3}