Problem with Union Query

raghavcacs

Board Regular
Joined
Mar 13, 2009
Messages
84
Hi i have a union query which picks data from a table and gives me a report.

Total no.of records has to be 400000 rows, but it is showing some where around 360000 rounds, 40000 rows are missing. I don't have any clues on this.

Can any one help me on this?
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,916
Office Version
  1. 365
Platform
  1. Windows
I believe that Union Queries automatically drop all records which are exact duplicates of other records.

Do you have duplicates in there (when considering all fields)?
Do you not want it to remove duplicates?
 

raghavcacs

Board Regular
Joined
Mar 13, 2009
Messages
84
Joe,
I suspected about duplicates. Yes, It has duplicates in 10 fileds out of a total of 15 fields. But these 10 fields are the deciding factor.

Actually the union query is to convert columns in to rows. The rows deciding factors are those 10 fields.

I want to have the duplicates also. Is there any way?
 

seenfresh

Well-known Member
Joined
Jul 12, 2006
Messages
1,141

raghavcacs

Board Regular
Joined
Mar 13, 2009
Messages
84
The purpose of this query is different that's why I used Union query. It is not pivoting the data.
 

seenfresh

Well-known Member
Joined
Jul 12, 2006
Messages
1,141
To include duplicates in a Union Query use the ALL keyword ie..

SELECT name, price, warranty_available, exclusive_offer
FROM Products
UNION ALL
SELECT name, price, guarantee_available, exclusive_offer
FROM Services;
 

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,328
Members
414,054
Latest member
Sameer50

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top