- HTML code
TYPE VALUE节点名称 模块一NAME 小明AGE 25
数据库的表是上面的格式。能不能将表中的数据直接查询为下面的格式。谢谢啊
节点名称 NAME AGE
模块一 小明 25
------解决方案--------------------
- SQL code
select [节点名称]= case when type='节点名称' then value end ,[NAME]= case when type='NAME' then value end ,[AGE]= case when type='AGE' then value end from 表
------解决方案--------------------
- SQL code
select [节点名称]= case when type='节点名称' then value end ,[NAME]= case when type='NAME' then value end ,[AGE]= case when type='AGE' then value end from 表case when就好了
------解决方案--------------------
select max(case type when '节点名称' then value else 0 end) as 节点名称,
max(case type when 'NAME' then value else 0 end) as NAME,
max(case type when 'AGE' then value else 0 end) as AGE,
from XXX group by xxx