- t.id AS tid,
- t.mail AS gmail,
- t.user_id AS uid,
- t.access,
- t.refresh,
- t.expired,
- GROUP_CONCAT(c.id ORDER BY c.id SEPARATOR "\\n") AS cids,
- GROUP_CONCAT(c.mail ORDER BY c.id SEPARATOR "\\n") AS cmails,
- GROUP_CONCAT(c.summary ORDER BY c.id SEPARATOR "\\n") AS csummaries,
- GROUP_CONCAT(IFNULL(c.synchronized, 'NULL') ORDER BY c.id SEPARATOR "\\n") AS csynchronizeds
-FROM Rapsys\AirBundle\Entity\GoogleToken AS t
-JOIN Rapsys\AirBundle\Entity\GoogleCalendar AS c ON (c.google_token_id = t.id)
-GROUP BY t.id
-ORDER BY NULL
+ b.tid,
+ b.gmail,
+ b.uid,
+ b.access,
+ b.refresh,
+ b.expired,
+ b.cids,
+ b.cmails,
+ b.csummaries,
+ b.csynchronizeds,
+ b.dids,
+ GROUP_CONCAT(us.subscribed_id ORDER BY us.subscribed_id SEPARATOR "\\n") AS sids
+FROM (
+ SELECT
+ a.tid,
+ a.gmail,
+ a.uid,
+ a.access,
+ a.refresh,
+ a.expired,
+ a.cids,
+ a.cmails,
+ a.csummaries,
+ a.csynchronizeds,
+ GROUP_CONCAT(ud.dance_id ORDER BY ud.dance_id SEPARATOR "\\n") AS dids
+ FROM (
+ SELECT
+ t.id AS tid,
+ t.mail AS gmail,
+ t.user_id AS uid,
+ t.access,
+ t.refresh,
+ t.expired,
+ GROUP_CONCAT(c.id ORDER BY c.id SEPARATOR "\\n") AS cids,
+ GROUP_CONCAT(c.mail ORDER BY c.id SEPARATOR "\\n") AS cmails,
+ GROUP_CONCAT(c.summary ORDER BY c.id SEPARATOR "\\n") AS csummaries,
+ GROUP_CONCAT(IFNULL(c.synchronized, 'NULL') ORDER BY c.id SEPARATOR "\\n") AS csynchronizeds
+ FROM Rapsys\AirBundle\Entity\GoogleToken AS t
+ JOIN Rapsys\AirBundle\Entity\GoogleCalendar AS c ON (c.google_token_id = t.id)
+ GROUP BY t.id
+ ORDER BY NULL
+ ) AS a
+ LEFT JOIN Rapsys\AirBundle\Entity\UserDance AS ud ON (ud.user_id = a.uid)
+) AS b
+LEFT JOIN Rapsys\AirBundle\Entity\UserSubscription AS us ON (us.user_id = b.uid)