Re: Problem deleting records
- From: Jim Jones <JimJones@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 1 Dec 2008 21:09:00 -0800
Allen
Many thanks
I should have been able to do this one myself!
Jim Jones
Botswana
"Allen Browne" wrote:
I think this is what you want:.
DELETE FROM Table2
WHERE EXISTS
(SELECT Candidate_ID
FROM Table1
WHERE Table1.Candidate_ID = Table2.Candidate_ID);
If subqueries are a new idea, here's an introduction:
http://allenbrowne.com/subquery-01.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Jim Jones" <JimJones@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:FAAEC88D-A490-45EB-A963-2D4621B9E1D8@xxxxxxxxxxxxxxxx
I have 2 tables. The first field of each table is the same - I call it
Candidate_ID - other fields are different.
In Table1, there is only one instance of each value of Candidate_ID,
whereas
in Table2 each value of Candidate_ID may occur more than once. There are
many values of Cadidate_ID in Table2 which do not occur in Table1.
For each unique value of Candidate_ID in Table1, I need to delete all
records which contain the same value of Candidate_ID in Table2.
I thought it would be easy, and since my VBA is still not so good, I have
been trying to use an SQL statement derived from the Query Design View -
so
far without success. Perhaps it can't be done with SQL.
Any help would be much appreciated
Jim Jones
Botswana
- References:
- Problem deleting records
- From: Jim Jones
- Re: Problem deleting records
- From: Allen Browne
- Problem deleting records
- Prev by Date: Re: setting field to null
- Next by Date: Re: Production Scheduling Database
- Previous by thread: Re: Problem deleting records
- Next by thread: Re: 3 column report
- Index(es):
Relevant Pages
|