Union Query - Select on One Field Criteria but show all fields

CJ

Board Regular
Joined
Feb 22, 2002
Messages
77
Hi
Can any see where I'm going wrong I have 2 tables joined in a Union Query when I put in all the fields I want (No Dups) I get Duplicates because of DQ errors is mainly in the address I.E. Adress 5 can be England, Great Britain or UK !!! Nightmare

So I want to just select on one field [OrderNumber] but get the query to show the whole line for that record. is this possible ?

I'm using this:

SELECT [OrdersMar10.OrderNumber],OrdersMar10.*
FROM [OrdersMar10]

UNION SELECT [OrdersApr10.OrderNumber],OrdersApr10.*
FROM [OrdersApril10]
ORDER BY [OrderNumber];

Thanks !!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi
Can any see where I'm going wrong I have 2 tables joined in a Union Query when I put in all the fields I want (No Dups) I get Duplicates because of DQ errors is mainly in the address I.E. Adress 5 can be England, Great Britain or UK !!! Nightmare

So I want to just select on one field [OrderNumber] but get the query to show the whole line for that record. is this possible ?

I'm using this:

SELECT [OrdersMar10.OrderNumber],OrdersMar10.*
FROM [OrdersMar10]

UNION SELECT [OrdersApr10.OrderNumber],OrdersApr10.*
FROM [OrdersApril10]
ORDER BY [OrderNumber];

Thanks !!

"So I want to just select on one field [OrderNumber] but get the query to show the whole line for that record. is this possible ?"

The SELECT statement shows the values for fields that you request.

SELECT fld1, fld2 FROM myTable ----will show fld1 and fld2
SELECT * FROM myTable--------------will show all fields

See http://www.w3schools.com/sql/sql_select.asp for SELECT statement syntax
See http://www.w3schools.com/sql/sql_union.asp for UNION syntax
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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
Back
Top