写sql时可以考虑的手段: 行转列 先分为多个临时表,然后JOIN到一起 select uid, t1.name YuWen, t2.name ShuXuefrom (select uid,
写sql时可以考虑的手段:
select uid, t1.name YuWen, t2.name ShuXuefrom (select uid, name from tableA where naem = '语文') t1 join (select uid, name from tableA where naem = '数学') t2 on t1.uid = t2.uid;
select uid, sum(if(name = '语文')) YuWen, sum(if(name = '数学')) ShuXuefrom tableAgroup by uid;
来源地址:https://blog.csdn.net/qq_40382400/article/details/132062061
--结束END--
本文标题: SQL-方法论
本文链接: https://lsjlt.com/news/414304.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0