oracle、mysql、sqlserver分组拼接

来源:互联网 发布:mac怎样关闭后台程序 编辑:程序博客网 时间:2024/05/15 23:51

oracle

select t.hassubreport,WMSYS.WM_CONCAT(t.templeteName) from t_report_reporttemplete t group by t.hassubreport

mysql

select t.hasSubReport,group_concat(t.templeteName) from t_report_reporttemplete t GROUP BY t.hasSubReport

sqlserver

select t.hasSubReport,b=stuff((select ','+f.templeteName from t_report_reporttemplete f where t.hasSubReport=f.hasSubReport for xml path('')),1,1,'') 
  from t_report_reporttemplete t
group by t.hasSubReport

0 0
原创粉丝点击