SQL中的行转列和列转行

复制SELECT uid,中转列转行 sum(if(course=语文, score, NULL)) as `语文`, sum(if(course=数学, score, NULL)) as `数学`, sum(if(course=英语, score, NULL)) as `英语`, sum(if(course=物理, score, NULL)) as `物理`, sum(if(course=化学, score, NULL)) as `化学` FROM scoreLong GROUP BY uid 1.2.3.4.5.6.7.8.
本文地址:http://www.bzuk.cn/html/169b5499776.html
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。