2017-03-10 71 views
0

的代碼如下:MySQL錯誤1066不是唯一的表/別名

Select Branch.BranchName, Sum(Inventory.OnHand) From Inventory, Branch 
Inventory.BranchNum = Branch.BranchNum 
Group By BranchName; 

我得到一個「不是唯一表」庫存和我不明白爲什麼。另外,爲什麼庫存和分支?

+0

隱連接是壞的。 –

回答

0

添加WHERE條款:

Select Branch.BranchName, Sum(Inventory.OnHand) 
From Inventory, Branch 
WHERE Inventory.BranchNum = Branch.BranchNum 
Group By BranchName; 
相關問題