且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

同一张表中的多个INNER JOIN

更新时间:2022-12-12 07:45:47

您应该为表指定不同的别名.您正在呼叫所有这些人.

You should specify different aliases for your tables . you are calling all of them m.

SELECT m1.MetalCode as 'Metal1', m2.MetalCode as 'Metal2',m3.MetalCode as 'Metal3'
FROM Item as k
INNER JOIN Metals AS m1 ON m1.metalID=k.metal1 
INNER JOIN Metals AS m2 ON m2.metalID=k.metal2
INNER JOIN Metals AS m3 ON m3.metalID=k.metal3
WHERE k.ItemID=?