level 3
name type
张三 游戏
张三 游泳
李四 爬山
李四 打球
王五 上网
王五 泡妞
拼接sql 显示结果:
张三, 游戏 游泳
李四, 爬山 打球
王五, 上网 泡妞
问题补充:我用的V8。0。1 怎写啊 求高手指教
2012年11月29日 05点11分
1
level 3
with temp as
(select name,max(case when num=1 then type end) as q1,max(case when num=2 then type end) as q2 from (select name,type,row_number()over(partition by name) as num from dw_test.rechange group by name,type)
group by name)
select name,q1||','||q2 as type from temp group by name,q1,q2;
2013年06月03日 06点06分
4