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

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

 

尝试写过使用","和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
posted @ 2015-11-19 16:04  风真天  阅读(1227)  评论(0编辑  收藏  举报