mh:工时 mhtype:工时类型(6种)
字段:userid mhtype mh
001 1 5
001 1 3
001 2 4
001 3 9
002 5 5
002 6 7
002 3 4
002 3 9
要求统计出每个人每一类工时的总合
结果要求如下格式
userid mhtype1 mhtype2 mhtype3 mhtype4 mhtype5 mhtype6 allmh
001 8 4 9 0 0 0 21
002 0 0 13 0 5 7 25
结果:
+--------+---------+---------+---------+---------+---------+---------+-------+
| userid | mhtype1 | mhtype2 | mhtype3 | mhtype4 | mhtype5 | mhtype6 | allmh |
+--------+---------+---------+---------+---------+---------+---------+-------+
| 001 | 8 | 4 | 9 | 0 | 0 | 0 | 21 |
| 002 | 0 | 0 | 13 | 0 | 5 | 7 | 25 |
+--------+---------+---------+---------+---------+---------+---------+-------+
2 rows in set (0.00 sec)