时间:2021-07-01 10:21:17 帮助过:8人阅读
上面这样一张表users,写sql语句查询出来要达到下面的效果
select name,
(select grade from users m where subject=‘语文‘ and m.name=users.name)as 语文,
(select grade from users m where subject=‘数学‘ and m.name=users.name)as 数学,
(select grade from users m where subject=‘地理‘ and m.name=users.name)as 地理,
(select grade from users m where subject=‘英语‘ and m.name=users.name)as 英语
from users
group by name;
sql
标签:ima info where png subject 语文 英语 select 数学