多行(结果集)拼接字符串 (多行变一行)

SQL Server版:

select stuff(
(
select
','+odr.ccontact
from t_order odr
join t_order_tour tot on tot.uteamid='A52D1FB4-64B2-4C04-AD6B-05BC4959BD21' and odr.uid=tot.uorderid
for xml path('')
)
,1,1,'')



Oracle:
SYS_CONNECT_BY_PATH
START WITH pid IS NULL CONNECT BY NOCYCLE PRIOR NO = pid

MySQL:
group_concat

详细可参考[url]http://www.cnblogs.com/kiant71/archive/2010/04/09/1752006.html[/url]

你可能感兴趣的:(MySQL,Oracle,SQL,Server)