Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
SELECT
CONCAT((SELECT u.`username` FROM `users` u WHERE u.`id` = t.`user_id`), ': ', t.`_groups`)
FROM (
SELECT
ug.`user_id`, GROUP_CONCAT(g.`title` SEPARATOR ', ') AS _groups
FROM `users_groups` ug
JOIN `groups` g ON g.`id` = ug.`groups_id`
GROUP BY ug.`user_id`
) t
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question