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!!
答案 0 :(得分:1)
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