[AccessD] Query gives duplicate records

Kaup, Chester Chester_Kaup at kindermorgan.com
Fri Jul 18 07:56:03 CDT 2008


Works perfect. Once again thanks to the group.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Asger Blond
Sent: Thursday, July 17, 2008 5:56 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Query gives duplicate records

Chester,

My previous posting had a closing parenthesis in the code, which should be
omitted -

This is supposed to work:

INSERT INTO [tbl Wells on SCADA] (Wellname) SELECT DISTINCT [qry Water
Injectors on SCADA].Wellname FROM [qry Water Injectors on SCADA] WHERE [qry
Water Injectors on SCADA].Wellname NOT IN (SELECT Wellname FROM [tbl Wells
on SCADA]);

Asger

-----Oprindelig meddelelse-----
Fra: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] På vegne af Kaup, Chester
Sendt: 17. juli 2008 23:08
Til: Access Developers discussion and problem solving
Emne: [AccessD] Query gives duplicate records

This query asks for a value for [tbl Wells on SCADA]![Wellname].

INSERT INTO [tbl Wells on SCADA] ( Wellname )
SELECT DISTINCT [qry Water Injectors on SCADA].Wellname
FROM [qry Water Injectors on SCADA]
WHERE ((([qry Water Injectors on SCADA].Wellname)<>[tbl Wells on
SCADA]![Wellname]));

If I modify the query like this I don't get asked for [tbl Wells on
SCADA]![Wellname] but I get duplicate records.


INSERT INTO [tbl Wells on SCADA] ( Wellname )

SELECT DISTINCT [qry Water Injectors on SCADA].Wellname

FROM [qry Water Injectors on SCADA], [tbl Wells on SCADA]

WHERE ((([qry Water Injectors on SCADA].Wellname)<>[tbl Wells on
SCADA]![Wellname]));

What am I doing wrong here. Thanks.



Chester Kaup

Engineering Technician

Kinder Morgan CO2 Company, LLP

Office (432) 688-3797

FAX (432) 688-3799





No trees were killed in the sending of this message. However a large number
of electrons were terribly inconvenienced.

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com












































































































































































--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list