如果FID是固定的只有1,2,3,4,可以用下面的sql实现 select MID, sum(case when fid = 1 then score else null end) score1, sum(case when fid = 2 then score else null end) score2, sum(case when fid = 3 then score else null end) score3, sum(case when fid = 4 then score else null end) score4 from tablename group by MID没有group by,你的条件用到的字段都需要在Group By里出现
select sum(case 1 then result1 when 2 then result2 end) as result from table group by ?
评论列表(0条)