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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete query with multiple values

Status
Not open for further replies.

nemmeh

Technical User
Jul 7, 2003
30
US
Hello everyone, bare with me if I seem a little newbish to you.

Ok, here's the scoop. I am trying to update a voter's database that I'm working with.

I have one table with all the current voters in it from 1997-2003. Well an update came out that has all the cancellations in it. I need to create a query that will delete the records from the 1997-2003 table that are listed in the cancellations table.

All the fields are the same in the 1997-2003 table, as well as the cancellation table. The "Registration Number" field is unique to every record.

I would like to, if possible get some help on creating a delete query that will.

1. Delete from the 1997-2003 table where "Registration Number" is equal to any of the values listed in the "Registration Number" field in the Cancellations table.

Is this possible? I'm sure it is, I just can't seem to figure out the syntax for it.

Any help or guidance you can give on this would be very much appreciated. Thank you..
 
Not sure if this the best way, but try

DELETE * FROM [19972003] WHERE RegistrationNumber IN (SELECT RegistrationNumber FROM Cancellations);

 
thanks a lot, worked perfectly.

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top