Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Help with DELETE statement

Posted on 2008-10-29
Last Modified: 2010-03-20
I have two tables joined by a composite key. (COMPANY_CD and RR_CD).
I want to delete all records from Table 1 where the record on Table 2 has a NULL value for e-mail address.

DELETE [100_Outlook_Contacts].*, Missing_IA_Codes.[E-mail address]
FROM 100_Outlook_Contacts INNER JOIN Missing_IA_Codes ON ([100_Outlook_Contacts].RR_CD = Missing_IA_Codes.RR_CD) AND ([100_Outlook_Contacts].COMPANY_CD = Missing_IA_Codes.COMPANY_CD)
WHERE (((Missing_IA_Codes.[E-mail address]) Is Null));

Question by:NO_CARRIER

Accepted Solution

jamesgu earned 75 total points
ID: 22832196
delete from 100_Outlook_Contacts
where exists (
             select 1
             from Missing_IA_Codes
             where [100_Outlook_Contacts].RR_CD = Missing_IA_Codes.RR_CD
              AND [100_Outlook_Contacts].COMPANY_CD = Missing_IA_Codes.COMPANY_CD
                  and Missing_IA_Codes.[E-mail address] Is Null

Author Comment

ID: 22832437
works awesome... that was way over my head.

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question