mysql中的GROUP_CONCAT和sqlserver实现同等结果解决方案
sqlserver的sql语句
SELECT ii_type,
[ii_bms] = stuff((
SELECT ',' + [ii_id]
FROM view_ylt_inspection_item t
WHERE t.ii_type = view_ylt_inspection_item.ii_type
FOR xml path('')) , 1 , 1 , '')
FROM view_ylt_inspection_item where ii_parent_id =0
GROUP BY ii_type;
效果图
mysql 的sql语句
select count(1) as count,ii_type,GROUP_CONCAT(ii_bm) as ii_bms from ylt_inspection_item where ii_parent_id =0 group by ii_type
效果图