日期:2014-05-17  浏览次数:20675 次

字段连接问题,在线等
现有一张表,内容如下:
ID NAME A
1 张三 a
1 张三 b
2 李四 a
3 王五 a
3 王五 b
3 王五 c

通过查询得出如下结果:
ID NAME A
1 张三 a,b
2 李四 a
3 王五 a,b,c

要达到这种查询结果,语句应该怎么写?

------解决方案--------------------
wm_concat

select id,name,wm_concat(A) as A from table
group by id,name
------解决方案--------------------
SQL code

select id,name,wmsys.wm_concat(A) A from table
group by id,name