首页 > 代码库 > 行转列

行转列

技术分享

 

select *from Result
select Time 日期,
sum
(
case
when Grade=‘胜‘ then 1
else 0
end
) as 胜,
sum
(
case
when Grade=‘负‘ then 1
else 0
end
) as 胜
from Result
group by Time

行转列