有一张表A 有字段 用户ID,请假类型,请假时间。
id type time(hours)
001 1 8
002 2 8
001 2 8
003 3 8做一张报表,显示为
id type=1 type=2 type=3
001 8 8 0
002 0 8 0
003 0 0 8请问sql怎么写?
id type time(hours)
001 1 8
002 2 8
001 2 8
003 3 8做一张报表,显示为
id type=1 type=2 type=3
001 8 8 0
002 0 8 0
003 0 0 8请问sql怎么写?
解决方案 »
- 初学者关于官方Mysql的疑问!!!
- 让大家帮我写一段这种需求的mysql存储过程
- 按以下查询操作,为什么俩个表记录数不一致呢
- 请教一个Sql
- 我的MYSQL无法正常启动
- 我的PHP+MySQL的论坛无法访问了,谁能帮我看看会是什么问题?
- Mysql Create table疑问请教
- 关于排序问题,我想间隔输出
- mysql无法远程连接
- 一个备份需求,劳烦各位留意一下
- 【Mysql-6.0.9】 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- mysql 存储过程的sql语句limit后面不能带变量
sum(if(type=3,time,0)) as type3 from tt group by id