user3860954
user3860954

Reputation: 99

# of columns in two selected tables or a query of a union query do not match

I have a simple qry that give me error

SELECT * 

FROM qry_ExecSum

inner join qry_IDS_IT_Everything on qry_ExecSum.P_Code = qry_IDS_IT_Everything.P_Code

It works good If change the * to column names like this :

SELECT qry_ExecSum.P_Code

FROM qry_ExecSum

inner join qry_IDS_IT_Everything on qry_ExecSum.P_Code = qry_IDS_IT_Everything.P_Code

All individual queries run good!!

Upvotes: 2

Views: 118

Answers (1)

P P P
P P P

Reputation: 227

Hope you are receiving error The multi-part identifier could not be bound, since both tables have the column named P_Code.

To avoid this you can specify the table name or table alias infront of the column name in the SELECT. That is the reason the second query doesn't return the error.

Upvotes: 3

Related Questions