Union Query Problem

  • Thread starter Thread starter Craig Hornish
  • Start date Start date
C

Craig Hornish

Hi,
I have 2 tables one is current Line orders from a Pervasive SQL database
returns 1344 records

SELECT ORDER_LINES.CUSTOMER, ORDER_LINES.DESCRIPTION, ORDER_LINES.PART
FROM ORDER_LINES
WHERE (((ORDER_LINES.FLAG_BOM)="Y" Or (ORDER_LINES.FLAG_BOM)="N"));

Second Is a history using the basic access table returns 38320 records

SELECT tmakOrder_Hist_Line.CUSTOMER, tmakOrder_Hist_Line.DESCRIPTION,
tmakOrder_Hist_Line.PART
FROM tmakOrder_Hist_Line
WHERE (((tmakOrder_Hist_Line.FLAG_BOM)="Y" Or
(tmakOrder_Hist_Line.FLAG_BOM)="N"));

Taking out the ";" and putting in Union I get 2649 records.

Any ideas of what the problem could be?

Thanks
Craig Hornish
 
Answering my own quetion.
Union was eliminating all duplicates if all fields matched - Used Union
All
 
UNION does a DISTINCT on the entire selection. That means any lines that are
identical get collapsed into one. Try using UNION ALL in place of UNION. UNION
ALL does not perform the distinct action.
 

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

Similar Threads

Duplicates in union query 3
Union query help - multiple unions 6
How to merge these 2 queries 1
Rename fields in Union query? 5
Union query? 7
Union Query 2
UNION question 3
append with union query? 6

Back
Top