Let's say I have these tables:
Table Persons:
ID Name
1 John
Table Groups:
ID Group
1 Admin
2 Printer
3 Server
Table PersonsAndGroups:
ID person_ID group_ID
1 1 1
2 1 2
3 1 3
Now I want a view that will give me this result:
PersonID PersonName Groups
1 John Admin, Printer, Server
I though of somehing like...
SELECT ID AS PersonID, Name AS PersonName, (SELECT ????) FROM Persons
... but I can't figure out the "subquery".
Any idea?
Thanks!