一条语句,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