View Single Post
  #2  
Old May 28th, 2010, 08:33 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Delete records from second table

Do you want to delete the records from the table or just SHOW the records?

SELECT tblSec.*
FROM tblSec INNER JOIN tblMain
ON tblSec.MainID = tblMain.MainID


DELETE
FROM TblSec
WHERE MainID NOT IN (SELECT MainID FROM tblMain)

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

sebastico wrote:
Hello
I have two Tables.
tblMain(MainID)
tblSec(FamID, Group, MainID)
MainID has same attribute in both tables
tblMain has the correct records.

How can I delete all records from tblSec not present in tblMain? Could you
tell me the kind of query. I'm studying Relational Algebra by myself and this
example would help me to learn
Thanks in advance