Union Query - Omitting Records

mreference

Registered User.
Local time
Today, 12:22
Joined
Oct 4, 2010
Messages
137
I have created a union query which appeared to be working correctly until I checked the actual data. I was expecting 82 records to be returned but am only getting 74.

This is my code
Code:
SELECT [Job_Nbr],[projectname],[FinProfileID],[finweek],[finmonthtext],[finyeartext],[Comments],[paid],[datepaid],format([TrueCost],"0.00") AS Charge,"Fixed" AS TypeFee
FROM [qryFixedFeePayments]
UNION SELECT [Job_Nbr],[projectname],[FinProfileID],[finweek],[finmonthtext],[finyeartext],[Comments],[paid],[datepaid],format([TrueCost],"0.00") AS Charge,"Adjustment" AS TypeFee
FROM [qryPaymentAdjuster]
UNION SELECT [Job_Nbr],[projectname],[FinProfileID],[finweek_nbr],[finmonthtext],[finyear_nbr],"No Comments",[paid],[datepaid],format([TrueCost],"0.00") AS Charge,"Timesheet" AS TypeFee
FROM [qryTimesheetandRates]
WHERE [TrueCost] <> 0
ORDER BY [FinProfileID];

If I run the above code I only get 74 records, all of which are located in the final select statement. When I delete the top two statements (which do not contain any records) the full 82 records appear.

If anyone can shed any light on this, it would be appreciated.
 
If the records returned (the exact values for each field) exist in both places, Access will only give you one of them, UNLESS you use UNION ALL instead of just UNION.
 
Yay, what a superstar! Grin from ear to ear, cheers Bob
 

Users who are viewing this thread

Back
Top Bottom