日期:2014-05-16 浏览次数:21074 次
select col1 姓名,
replace(wm_concat(col2),',',' or ') 年龄,
replace(wm_concat(col3),',',' or ') 性格,
replace(wm_concat(col4),',',' or ') ip地址
from t1
group by col1
姓名 年龄 性格 ip地址
---------------------------------
1 李四 21 or 21 成熟 or 成熟 127.0.0.3 or 13.0.1.3
2 王五 25 大器 127.0.0.8
3 张三 18 or 18 开朗 or 开朗 127.0.0.1 or 13.0.1.2
------解决方案--------------------
select * from table where age in(select distinct age from table where name='张三')
union all select * from table where xingge in(select distinct xingge from table where name='张三')
union all select * from table where ip in(select distinct ip from table where name='张三')