postgresql7.1 insert into adv_group_map (group_key, adv_key) select :group_key, :adv_key where not exists (select 1 from adv_group_map where adv_key = :adv_key and group_key = :group_key)