用sql语句实现在同一张表中找到1个字段相同,另1个字段不同的记录

日期:2019-08-31 10:06:04 人气:1

用sql语句实现在同一张表中找到1个字段相同,另1个字段不同的记录

如果是sql server 2005以下,可以用如下方式来实现 select t.col1, stuff((select '、'+ convert(varchar(10),t1.col2) from A t1 where t1.col1= t.col1 for xml path('')),1,1,'') as col2 from A t group by t.col1
    A+
热门评论