Append query duplication despite checking records

N

Neil Webster

Hi,

I have a problem that is really bugging me, I'm trying to append
records to a table based on a criteria. Part of the query checks for
the existence of the the records to be appended in the destination
table.

The problem I'm having is I still end up with duplicates despite this
check.

Can anybody shed any light on where I'm going wrong?

The query I'm using is:
INSERT INTO Intakes2 ( SHAPE, DRN_ID, FROMNODE, TONODE, SHAPE_Length )
SELECT DRN.SHAPE, DRN.DRN_ID, DRN.FROMNODE, DRN.TONODE,
DRN.SHAPE_Length
FROM Intakes2, DRN
WHERE ((([Intakes2]![FROMNODE])=[DRN]![TONODE]) AND ((Exists (select *
from Intakes2 where Intakes2.DRN_ID =DRN.DRN_ID))=False));

I'm trying to using the query in a python program so would prefer to
keep it as one query/step, I feel it should be possible.

Thanks for any help you can offer.

Cheers

Neil
 
T

Tom van Stiphout

On Wed, 1 Jul 2009 05:49:57 -0700 (PDT), Neil Webster

Rather than "... and Exists (....) = False"
use:
"... and Not Exists (...)"

-Tom.
Microsoft Access MVP
 
N

Neil Webster

Tom,

Thanks for the reply.

I've just tried that amendment, but it's still spitting out
duplicates?

Is there something else I've missed?

Cheers

Neil



On Wed, 1 Jul 2009 05:49:57 -0700 (PDT), Neil Webster


Rather than "... and Exists (....) = False"
use:
"... and Not Exists (...)"

-Tom.
Microsoft Access MVP


I have a problem that is really bugging me, I'm trying to append
records to a table based on a criteria.  Part of the query checks for
the existence of the the records to be appended in the destination
table.
The problem I'm having is I still end up with duplicates despite this
check.
Can anybody shed any light on where I'm going wrong?
The query I'm using is:
INSERT INTO Intakes2 ( SHAPE, DRN_ID, FROMNODE, TONODE, SHAPE_Length )
SELECT DRN.SHAPE, DRN.DRN_ID, DRN.FROMNODE, DRN.TONODE,
DRN.SHAPE_Length
FROM Intakes2, DRN
WHERE ((([Intakes2]![FROMNODE])=[DRN]![TONODE]) AND ((Exists (select *
from Intakes2 where  Intakes2.DRN_ID =DRN.DRN_ID))=False));
I'm trying to using the query in a python program so would prefer to
keep it as one query/step, I feel it should be possible.
Thanks for any help you can offer.

Neil- Hide quoted text -

- Show quoted text -
 
T

Tom van Stiphout

On Wed, 1 Jul 2009 07:08:18 -0700 (PDT), Neil Webster

If you like you can email me a zipped copy your database, stripped
down to the bare essentials. You should be able to figure out my
..no.spam protection.

-Tom.
Microsoft Access MVP

Tom,

Thanks for the reply.

I've just tried that amendment, but it's still spitting out
duplicates?

Is there something else I've missed?

Cheers

Neil



On Wed, 1 Jul 2009 05:49:57 -0700 (PDT), Neil Webster


Rather than "... and Exists (....) = False"
use:
"... and Not Exists (...)"

-Tom.
Microsoft Access MVP


I have a problem that is really bugging me, I'm trying to append
records to a table based on a criteria.  Part of the query checks for
the existence of the the records to be appended in the destination
table.
The problem I'm having is I still end up with duplicates despite this
check.
Can anybody shed any light on where I'm going wrong?
The query I'm using is:
INSERT INTO Intakes2 ( SHAPE, DRN_ID, FROMNODE, TONODE, SHAPE_Length )
SELECT DRN.SHAPE, DRN.DRN_ID, DRN.FROMNODE, DRN.TONODE,
DRN.SHAPE_Length
FROM Intakes2, DRN
WHERE ((([Intakes2]![FROMNODE])=[DRN]![TONODE]) AND ((Exists (select *
from Intakes2 where  Intakes2.DRN_ID =DRN.DRN_ID))=False));
I'm trying to using the query in a python program so would prefer to
keep it as one query/step, I feel it should be possible.
Thanks for any help you can offer.

Neil- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top