Union Query Column mismatch (1 Viewer)

Gismo

Registered User.
Local time
Today, 20:34
Joined
Jun 12, 2017
Messages
1,088
Hi all,

Please could you assist in the error I receive for number of columns in 2 selected queries of union query do not match

SELECT [Registration], [Order], [Opr# short text], [Purchase Req#]
FROM [Outstanding Items - IW49]
WHERE ((([IW49 Local TBL].[Registration])="ZT-HZA") AND (([IW49 Local TBL].[Order])="85391") AND (([IW49 Local TBL].[Control key])="ZA02"))

Union

Select [Registration], [Order],[Short Text]
From [Outstanding Items - ME2J]
WHERE ((([ME2J Local TBL].Registration)="ZT-HZA") AND (([ME2J Local TBL].Order)="85391"));
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:34
Joined
May 7, 2009
Messages
16,504
you are missing "purchase req#" on your Union.
union query must have same number of columns.
 

Gismo

Registered User.
Local time
Today, 20:34
Joined
Jun 12, 2017
Messages
1,088
I dont have purchase requisition on the union, only on the first section

I need to see all order numbers for both and the requisition number on the first
On the second part I only have a text
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 01:34
Joined
May 7, 2009
Messages
16,504
you need to provide it by "faking" it:

...
...
Union

Select [Registration], [Order],[Short Text], "" As [Purchase Req#]
From [Outstanding Items - ME2J]
WHERE ((([ME2J Local TBL].Registration)="ZT-HZA") AND (([ME2J Local TBL].Order)="85391"));
 

Users who are viewing this thread

Top Bottom