Creating delete query based on matching fields between two tables

  • Follow


I'm sure there's already one if not several posts for this but I couldn't 
any. I have two tables both the same serial code field. I want to a basic 
delete from tableA where tableA and tableB have matching serial codes. I have 
tried just joining the two table by the serial code field in a delete  query 
but no matter how I try to go about it nothing works. 

Thanks in advance for any assistance you can provide on this issue.

DBGuy11
0
Reply Utf 11/24/2009 5:42:01 PM

DELETE FROM tableA
WHERE tableA.SerialCode IN (SELECT DISTINCT SerialCode FROM tableB)

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"DBGuy11" <DBGuy11@discussions.microsoft.com> wrote in message 
news:26CA7107-258F-41DC-97EE-5B951AA11E59@microsoft.com...
> I'm sure there's already one if not several posts for this but I couldn't
> any. I have two tables both the same serial code field. I want to a basic
> delete from tableA where tableA and tableB have matching serial codes. I 
> have
> tried just joining the two table by the serial code field in a delete 
> query
> but no matter how I try to go about it nothing works.
>
> Thanks in advance for any assistance you can provide on this issue.
>
> DBGuy11 


0
Reply Douglas 11/24/2009 5:54:00 PM


1 Replies
866 Views

(page loaded in 0.05 seconds)

Similiar Articles:
















7/29/2012 10:39:27 AM


Reply: