标签:
select * from ( SELECT ‘C_DILEI‘ as fen,‘地类‘ as fcn, ‘NVARCHAR‘as ftype, ‘2‘as flen, ( SELECT count(1) FROM xbmbd WHERE len(ISNULL(C_DILEI,‘‘)) > 2 ) as rnum, ( SELECT CAST(C_DILEI AS VARCHAR(50))+‘,‘ FROM xbmbd WHERE len(ISNULL(C_DILEI,‘‘)) > 2 GROUP BY C_DILEI ORDER BY C_DILEI for xml path(‘‘) ) as fval ) t where fval is not null
输出结果如下:
标签:
原文地址:http://www.cnblogs.com/janehlp/p/4693337.html