SELECT stuff((select ',' + PUD_Dept from PB_User_Dept t where PUD_User = PUB_ID for xml path('')) , 1 , 1 , '') FROM [dbo].[PB_User_Base]