Solved

Help with DELETE statement

Posted on 2008-10-29
2
190 Views
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.

i.e.
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));

0
Comment
Question by:NO_CARRIER
2 Comments
 
LVL 9

Accepted Solution

by:
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
0
 
LVL 1

Author Comment

by:NO_CARRIER
ID: 22832437
works awesome... that was way over my head.
Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now