I am looking to find all the single entries in a table where there should only be double entries.
I am looking to find all instances where the 2nd record does not exist.
The ID for each record will always be the same (although I do not know what that ID will be specifically) and the Localisation Format ID will always be 1 and 2. I am looking to find all entries where Localisation Format ID 2 does not exist.
SELECT * WHERE ID has Localisation_Format_ID = 1 but does not have Localisation_Format_ID = 2
This is a simple not exists criteria:
select * from t where not exists ( select * from t t2 where t2.Id = t.Id and t2.Localisation_Format_ID = 2 );
Answered By – Stu
Answer Checked By – Terry (BugsFixing Volunteer)