日期:2014-05-16  浏览次数:20449 次

多行(结果集)拼接字符串
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

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