当前位置: 代码迷 >> Java Web开发 >> 数据库,该如何解决
  详细解决方案

数据库,该如何解决

热度:745   发布时间:2016-04-17 16:35:49.0
数据库
在数据库表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就可以读取了
  相关解决方案