标签:ima info where png subject 语文 英语 select 数学
上面这样一张表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;
标签:ima info where png subject 语文 英语 select 数学
原文地址:https://www.cnblogs.com/liliuguang/p/9928493.html