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

有时间的帮忙看上

2012-09-24 
有时间的大虾帮忙看下HTML codeTYPEVALUE节点名称模块一NAME小明AGE25数据库的表是上面的格式。能不能将表

有时间的大虾帮忙看下

HTML code
TYPE    VALUE节点名称    模块一NAME    小明AGE    25

数据库的表是上面的格式。能不能将表中的数据直接查询为下面的格式。谢谢啊
节点名称NAMEAGE
模块一小明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

热点排行