Vũ Hồng Kỳ
Vũ Hồng Kỳ

Reputation: 63

The multi-part identifier "Table.column" could not be bound on Inner Join

Please, help me.

I have 2 tables: MainInfo (userName, pw)& BasicInfo (userName, birthday, phone). I do an query as follow:

SELECT MainInfo.userName, pw, birthday, phone
FROM MainInfo M INNER JOIN BasicInfo B
ON M.userName = B.userName

But it throw an error: The multi-part identifier "MainInfo.userName" could not be bound. What's wrong? I don't understand! I think about it very much, but still don't know why. Please help me!!

Upvotes: 0

Views: 1463

Answers (1)

M.Ali
M.Ali

Reputation: 69504

Once you have aliased your table, use the alias to use TWO PART names for columns. i.e [TableAlias].[ColumnName]

SELECT M.userName
      ,M.pw
      ,B.birthday
      ,B.phone
FROM MainInfo M INNER JOIN BasicInfo B
ON M.userName = B.userName

Upvotes: 1

Related Questions