I am not at all conversant in SQL so was hoping someone could help me with a query that will find all the records in a parent table for which there are no records in a child
With another example as
id: SERIAL
name: TEXT
enumerate_id: INT
SELECT id, name, enumerate_id
FROM enumerate p
WHERE EXISTS (
SELECT 1 FROM enumerate c
WHERE c.enumerate_id = p.id
);
SELECT id, name, enumerate_id
FROM enumerate p
WHERE NOT EXISTS (
SELECT 1 FROM enumerate c
WHERE c.enumerate_id = p.id
);
Note that the only one who changes is the
NOTEXISTS
Hope it helps