postgresql7.4
SELECT groups.group_name,
dotfolio_users.last_name || ', ' ||
dotfolio_users.first_names AS adviser, groups.group_id
FROM groups, dotfolio_group_adviser_map, dotfolio_users
WHERE groups.group_id = dotfolio_group_adviser_map.group_id
AND dotfolio_group_adviser_map.adviser_id = dotfolio_users.user_id
ORDER BY groups.group_id ASC