首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sql 行转列,运用case when then

2012-07-16 
sql 行转列,使用case when then?行转列,使用case when then ?selectdate,sum(case c.type when try-pay

sql 行转列,使用case when then

?

行转列,使用case when then

?

selectdate,sum(case c.type when 'try-pay' then c.sum else 0 end ) as 'try-pay',sum(case c.type when 'pay-real' then c.sum else 0 end )as 'pay-real',sum(case c.type when 'pay-success' then c.sum else 0 end )as 'pay-success',sum(case c.type when 'pay-failure' then c.sum else 0 end )as 'pay-failure',sum(case c.type when 'notify-input' then c.sum else 0 end )as 'notify-input',sum(case c.type when 'normal-query' then c.sum else 0 end )as 'normal-query'from(SELECT sum(f_count) as sum ,f_type as type ,f_date as date FROM t_log_analyse group by f_type,f_date order by f_date desc) as cgroup by date

?

?

热点排行