I've got two tables called Patient and Account. Patient has PatientID as it's PrimaryKey. Account has AccountID as PK and PatientID is a Foreign Key and also has treatmentDate as a tuple.
I want to delete all patients that have not had an account since 2005. this is what I've got:
DELETE FROM PATIENT
WHERE PATIENTID IN (
select account.PatientID
from ACCOUNT
where Treatmentdate < '01-JAN-2005' );
DELETE FROM ACCOUNT
WHERE PATIENTID IN (
select account.PatientID
from ACCOUNT
where Treatmentdate < '01-JAN-2005' );
is there any other way in which I can do this?