SQL Query to return one-to-many relationship in columns -


sql newbie here.

i trying return table list of memberships belong each user. data in 2 tables, 1 table of users name , description, , other table 1 or more records each user name , membership identifier:

user table name   description ------ ----------- user01 first user user02 second user  membership table name   membership ------ ---------- user01 group01 user01 group02 user02 group01 user02 group03 user02 group05 

so far code have returns 1 line each membership user has:

select     u.name, u.description, m.groupname         user u, membership m     u.name = m.username order u.name   name   description membership ------ ----------- ---------- user01 first user  group01 user01 first user  group02 user02 second user group01 user02 second user group03 user02 second user group05 

i want return list of users, followed groups user belongs to:

name   description membership ------ ----------- ---------- user01 first user  group01, group02 user02 second user group01, group03, group05 

how kind of result ?

thank !


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -