SQL 合并多条记录为一条
摘要:
-- 示例数据DECLARE@tTABLE(id int, value varchar(10))INSERT@tSELECT1, 'aa'UNIONALLSELECT1, 'bb'UNIONALLSELECT2, 'aaa'UNIONALLSELECT2, 'bbb'UNIONALLSELECT2, 'ccc'-- 查询处理SELECT*FROM( SELECTDISTINCT id FROM@t)AOUTER APPLY( SELECT [values]=STUFF(REPLACE(REPLACE( ( SELE 阅读全文
posted @ 2012-07-20 10:16 elvis blogs 阅读(1306) 评论(1) 推荐(0) 编辑