Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete query 1

Status
Not open for further replies.

din2005

Programmer
Mar 22, 2005
162
GB
Hi all,

i have two table linked delete the records that match tblnotinsheffield to tblappointments i.e

all the records in tblnotinsheffield match with tblappointments and delete it from tblappointments.

my code is this so far

DELETE tblAppointments.DiaryDate, tblAppointments.HospitalNo, tblNotInSheffield.HospitalNo
FROM tblNotInSheffield INNER JOIN tblAppointments ON tblNotInSheffield.HospitalNo = tblAppointments.HospitalNo;

but am a loss how to do the rest?
 
Hi

How about:

DELETE FROM tblAppointments WHERE HospitalNo IN (SELECT tblNotInSheffield.HospitalNo
FROM tblNotInSheffield);

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top