当前位置: 代码迷 >> Sql Server >> 把行转成列如何操作
  详细解决方案

把行转成列如何操作

热度:80   发布时间:2016-04-24 23:11:33.0
把行转成列怎么操作?
怎么把这个表

查询成这个样子?

------解决方案--------------------

select name,
    max(case when actionname = 'add' then '增加' else null end) 'add',
    max(case when actionname = 'del' then '删除' else null end) 'del',
    max(case when actionname = 'read' then '读取' else null end) 'read'
from tb
group by name
  相关解决方案