首页 > 数据库技术 > 详细

sql 同一行中,不同结果在不同列显示

时间:2015-11-19 16:29:37      阅读:158      评论:0      收藏:0      [点我收藏+]

对不同条件查询到的结果在同一行中展示

 

尝试写过使用","和inner join两种方式,感觉使用","的更加直观

 

select table1.guid, table1.content name, table2.content sex, 
table3.content age

from
(
select guid, content
from table
where type=‘姓名‘
) table1
,(
select guid, content
from table
where type=‘性别‘
) table2
,(
select guid, content
from table
where type=‘年龄‘
) table3
where table1.guid = table2.guid
and table2.guid = table3.guid

sql 同一行中,不同结果在不同列显示

原文:http://www.cnblogs.com/fengzhentian/p/4977938.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!