sql语句,按一个字段中的值当作结果列,列出表数据,如图
sql语句,按一个字段中的值当作结果列,列出表数据,如图
日期:2017-08-16 09:13:56 人气:1
select year ,count(m1) m1,count(m2) m2,count(m3) m3,count(m4) m4 from
(select year , count(1) m1,0 m2,0 m3, 0 m4 from tab where month='1' group by year
union all
select year , 0 m1,count(1) m2,0 m3, 0 m4 from tab where month='2' gro