用一条SQL语句查询一张表得到不同条件的多个结果

一条语句,12个结果,12行,比较方便与1个dataGridView的现实。

我是用在C# Winform上的3层结构的开发上,用这个实现统计12个月每个月的销售总额。现在就差统计表了,GDI功底比较差,还在研究呵呵。

 

SELECT A1.date 日期, SUM(A1.sum) 销售额 FROM t_business A1 WHERE A1.date between '2009-1-1' and '2009-1-31'

or date between '2009-2-1' and '2009-2-27'

or date between '2009-3-1' and '2009-3-31'

or date between '2009-4-1' and '2009-4-30'

or date between '2009-5-1' and '2009-5-31'

or date between '2009-6-1' and '2009-6-30'

or date between '2009-7-1' and '2009-7-31'

or date between '2009-8-1' and '2009-8-31'

or date between '2009-9-1' and '2009-9-30'

or date between '2009-10-1' and '2009-10-31'

or date between '2009-11-1' and '2009-11-30'

or date between '2009-12-1' and '2009-12-31'

GROUP BY A1.date

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值