select * from tableA union select * from tableB where not exists(select * from tableA where pk = tableB.pk) or select * from tableA union select * from tableB where pk not in (select pk from tableA) or use union all