摘要:
if Object_id('tb1') is not null Drop table tb1;gocreate table tb1(date int primary key, sale int);goinsert into tb1(date, sale)select 1, 20 union allselect 2, 15 union allselect 3, 14 union all select 4, 18 union all select 5, 30;select * from tb1;--方法一,单个聚合select date, sale, (select sum(sal 阅读全文