Selecting Records From two tables with many to many relationship I have two tables user and rights.I want to fetch each user with its assigned right as I attached the screen shot of tables plus result I want.FYI I use PostgreSQL.
Any solution is highly appreciated.
Thanks In advance.
SELECT u.uid, u.login, STRING_AGG(r.code, ',') code
FROM UserTable u
/* LEFT */ JOIN Rights r ON u.uid = r.uid
GROUP BY u.uid, u.login