Subject Re: [ib-support] Automatically remove unused PK's from second table??
Author Svein Erling Tysvær
Derek,

>How do I remove the car types that are no longer referenced with a
>foreign key in the t_persons table?

The SQL to be used would be:

DELETE FROM t_cars
WHERE NOT EXISTS (SELECT 1 FROM t_persons
WHERE t.persons.car_id_fk = t_cars.car_id_pk)

Set