mysql 行转列

select channel, time_create,  sum(if(`event_name`='v',event_num,0)) as 'video_watch_num',sum(if(`event_name`='s',event_num,0)) as 'share_num' from wx0d77_base group by channel, time_create  order by channel

参考文章
https://www.cnblogs.com/xiaoxi/p/7151433.html

你可能感兴趣的:(mysql 行转列)