Union Query Column mismatch (1 Viewer)

Gismo

Registered User.
Local time
Today, 12:07
Joined
Jun 12, 2017
Messages
1,298
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
Today, 17:07
Joined
May 7, 2009
Messages
19,232
you are missing "purchase req#" on your Union.
union query must have same number of columns.
 

Gismo

Registered User.
Local time
Today, 12:07
Joined
Jun 12, 2017
Messages
1,298
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
Today, 17:07
Joined
May 7, 2009
Messages
19,232
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