Delete Query – Error message

brucey54

Registered User.
Local time
Today, 06:40
Joined
Jun 18, 2012
Messages
155
Hi Folks, having error message when I try to run this query,


Error Message (The Search key was not found in any record)


But if I change the MealDate = DateAdd("M", -1, Date it works ok

DELETE *

FROM TblPatient
WHERE EXISTS


(SELECT *
FROM TblDietPlan
WHERE TblPatient.PatientID=TblDietPlan.PatientID and Discharge = Yes And MealDate < DateAdd("M", -1, Date( )));
 
JOIN the two tables, do not use the SELECT subQuery like that.
 

Users who are viewing this thread

Back
Top Bottom