salliven (5/4/2013)
Please check this code:
select
a.*,
STUFF((SELECT ', '+name FROM bb WHERE colorid = a.colorid FOR XML PATH('')) , 1 , 1 , '' )
from aa a
If you change the second "1" to a 2, it'll get rid of the leading space.
--Jeff Moden
Change is inevitable... Change for the better is not.