[AccessD] Wrong number of records returned in Union query

Hale, Jim Jim.Hale at FleetPride.com
Mon Apr 9 12:57:59 CDT 2007


Union All worked. I tried Distinct when I was fiddling around trying to find
a solution. Thanks
Jim Hale

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of ewaldt at gdls.com
Sent: Monday, April 09, 2007 12:09 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Wrong number of records returned in Union query


If you want the duplicates, why are you using the "DISTINCT" keyword, 
which tells Access that you don't want them? If you want the duplicates, 
don't use either of the distinct or distinctrow keywords.

Sorry if this is too simple, but your SQL code doesn't seem to match what 
you say you're looking for.

Thomas F. Ewald
Stryker Mass Properties
General Dynamics Land Systems


Date: Mon, 9 Apr 2007 11:39:02 -0500 
From: "Hale, Jim" <Jim.Hale at FleetPride.com>
Subject: [AccessD] Wrong number of records returned in Union query
To: accessd at databaseadvisors.com
Message-ID:
<FBEA4C39D7934A47A057CDFD3CF070EF12AAD6 at corp-es01.fleetpride.local>
Content-Type: text/plain

I have a simple select  query that returns a different number of records
when it is run by itself than when it is run inside a union query. I 
believe
it is because duplicate records (which I need) are being dropped.  I have
tried the distinct and distinctrow key words in the union query to no 
avail.
Can someone tell me how to fix this? Thanks

The SQL for the union query is as follows ( the first query is the broken
one:

***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.


More information about the AccessD mailing list