SqlServer实现oracle10g的 wmsys.wm_concat()

来源:互联网 发布:linux vi 搜索 下一个 编辑:程序博客网 时间:2024/05/23 02:01
-- 查询处理 --SQL2005中的方法2 create table tb(id int, value varchar(10))insert into tb values(1, 'aa')insert into tb values(1, 'bb')insert into tb values(2, 'aaa')insert into tb values(2, 'bbb')insert into tb values(2, 'ccc')go select id, [values]=stuff((select ','+[value] from tb t where id=tb.id for xml path('')), 1, 1, '')from tbgroup by id
0 0
原创粉丝点击