行转列面试题 事例

--行转列面试题

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 --日期分组

原文地址:https://www.cnblogs.com/xiaobaicom/p/6565119.html