--行转列面试题
select rq sa 日期 ,
(
casae
when shengfu='胜'then 1
else 0
end
)as胜,
sum
(
casae
when shengfu='负'then 1
else 0
end
)as负,
from tmp
group by rq --日期分组
--行转列面试题
select rq sa 日期 ,
(
casae
when shengfu='胜'then 1
else 0
end
)as胜,
sum
(
casae
when shengfu='负'then 1
else 0
end
)as负,
from tmp
group by rq --日期分组