mysql数据汇总解决办法

mysql数据汇总解决办法

mysql数据汇总

如一张表里数据如下

statedate statehour hrtimes 

2011-12-27 10 10

2011-12-27 16 22

2011-12-27 17 3 

2011-12-28 10 33

2011-12-28 14 5

如何将这两天的数据并在一起,成为

 statehour hrtimes

  10 43 

  14 5

  16 22

  17 3

这里statehour 如相同的话就将它加在一起。这个sql语句怎么写呢?



select statehour ,sum(hrtimes)

from 如一张表

Group by statehour




select statehour,sum(hrtimes) from TT Group by statehour




探讨

select statehour ,sum(hrtimes)

from 如一张表

Group by statehour

mysql数据汇总解决办法

相关文章:

    你感兴趣的文章:

    标签云: