解决方案 »
- 如何解决java.lang.NullPointerException问题
- JSP java 用户登录
- Struts2中如何用ognl表达式读取properties中的值?
- 如何实现结算功能啊?jsp的有代码。看哪出错了?
- 求MyEclipse_6.0.1GA_E3.3.1_FullStackInstaller.exe
- Java web中为什么用xml做配置文件
- 我在国外做web developer,私下里也会接活,有国内的朋友愿意合作吗?
- EP是什么工具
- 又一个中文字符丢失的问题。。。
- myeclipse 导入完项目如何导入mysql数据库???
- 从数据库中取记录时遇到的奇怪的问题(对我来说)。
- 高手相助,No ResultSet set was produced的问题?
sum(decode(t.course, '语文', score,null)) as 语文,
sum(decode(t.course, '数学', score,null)) as 数学,
sum(decode(t.course, '英语', score,null)) as 英语
from test_tb_grade t
group by t.user_name
order by t.user_name
group by stuid,name 已找到答案
mysql> select id as 序号, name as 名字,
-> max(case subject WHEN '数学' then score else null end ) 数学,
-> max(case subject WHEN '语文' then score else null end ) 语文,
-> max(case subject WHEN '英语' then score else null end ) 英语
-> from stuscore
-> where name='张三';
+------+------+------+------+------+
| 序号 | 名字 | 数学 | 语文 | 英语 |
+------+------+------+------+------+
| 1 | 张三 | 89 | 80 | 70 |
+------+------+------+------+------+
1 row in set (0.00 sec)