SELECT DISTINCT notice_id as object_id, "NOTI" as object_type FROM `notices` left join notices_relations nr1 on nr1.num_notice=notice_id left join notices_relations nr2 on nr2.linked_notice=notice_id where nr1.num_notice is null and nr2.linked_notice is null