Solved

Help with DELETE statement

Posted on 2008-10-29
2
229 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
[X]
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
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

717 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