日期:2014-05-18  浏览次数:20652 次

数据库
在数据库表total中有如下信息:
year         month     day       peoplen       peoplew         peoples
year为某一年 month为一年的12个月    day为天     
peoplen       peoplew         peoples为人数统计  为int型
现在想统计2007年1月到12月的每个月中peoplen         peoplew       peoples 每个的总和

统计后最后的结果为:
                      peoplen总数           peoplew总数           peoples总数
一月
二月
三月
四月
五月
六月
七月
八月
九月
十月
十一月
十二月      
请问一下   该怎么实现?

------解决方案--------------------
select month , sum(peoplen ),sum(peoplew ),sum(peoples ) from total group by month where year = 2007
------解决方案--------------------
select distict month , sum(peoplen ),sum(peoplew ),sum(peoples ) from total group by month where year = '2007 '

------解决方案--------------------
循环读取rs就可以读取了