SELECT `user`.*
, (SELECT GROUP_CONCAT(`usergroup_id`) FROM `usergroup_xref` WHERE `usergroup_xref`.`user_id` = `user`.`id`) AS `usergroup_ids`
FROM `users` AS `user`
In the above example you could retrieve all of the users group ids along with the user row within a single query.