-SELECT a.id, a.pseudonym, a.g_id, a.g_title
-FROM (
- SELECT u.id, u.pseudonym, g.id AS g_id, g.title AS g_title
- FROM RapsysAirBundle:User AS u
- JOIN RapsysAirBundle:GroupUser AS gu ON (gu.user_id = u.id)
- JOIN RapsysAirBundle:Group AS g ON (g.id = gu.group_id)
- ORDER BY g.id DESC
- LIMIT 0, :limit
-) AS a
-GROUP BY a.id
-ORDER BY a.id ASC
+SELECT u.id, u.mail, u.pseudonym, g.id AS g_id, g.title AS g_title
+FROM RapsysAirBundle:User AS u
+JOIN RapsysAirBundle:UserGroup AS gu ON (gu.user_id = u.id)
+JOIN RapsysAirBundle:Group AS g ON (g.id = gu.group_id)
+ORDER BY g.id DESC, u.id ASC