0

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!

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
MojoDK
  • 4,237
  • 9
  • 40
  • 75

0 Answers0