Handy shortcut used to concatenate all areas into comma-delim string:
select
distinct
stuff((
select ',' + u.AREA_ID
from myTableu
where u.USER_ID = 'C1663'
order by u.AREA_ID
for xml path('')
),1,1,'') as userlist
from myTable
group by AREA_ID
No comments:
Post a Comment