----Base
A user corresponds to multiple roles.
Use convert(VARCHAR,role_id) to escape role_id for int type
----sql:
select b.user_id ,
roles = stuff((select ',' + convert(VARCHAR, t.ROLE_ID) from base_user_role t where b.USER_ID = t.user_id for xml path('')) , 1 , 1 , '') from base_user_role b group by b.user_id