select pretty_name
from adv_groups
where group_key = :group_key
select group_key, pretty_name
from adv_groups
where not group_key in (select group_key from adv_group_map)
select map.group_key, advs.adv_key
from advs, adv_group_map map
where advs.adv_key = map.adv_key
UNION
select NULL, advs.adv_key
from advs
where 0=(select count(*) from adv_group_map where advs.adv_key = adv_group_map.adv_key)