以下查询
SELECT TOP 1000 tb.firstName
,tb.secondName
,tb.startYear
,nb.primaryName
,tr.averageScore
,tr.numVotes
,g.subjectDescription
,tb.isActive
FROM team_basics tb
,ground g
,info_basics nb
INNER JOIN title_ground tg ON tb.ident = tg.ident
INNER JOIN name_title nt ON tb.ident = nt.ident
LEFT JOIN title_ratings tr ON tb.ident = tr.ident
WHERE nb.nconst = nt.nconst
AND tg.groundId = g.groundId
ORDER BY tr.averageScore DESC
,tb.startYear DESC;
我收到以下错误:
The multi-part identifier "tb.ident" could not be bound.
之前这些是隐式连接,但试图解决我将它们更改为显式内部连接但仍然是我收到此错误。请提出解决方案。
答案 0 :(得分:3)
从不在FROM
子句中使用逗号。 始终使用正确的JOIN
语法。
因此,请将FROM
子句写为:
FROM team_basics tb INNER JOIN
title_ground tg
ON tb.ident = tg.ident INNER JOIN
ground g
ON tg.groundId = g.groundId INNER JOIN
name_title nt
ON tb.ident = nt.ident INNER JOIN
info_basics nb
ON nb.nconst = nt.nconst LEFT JOIN
title_ratings tr
ON tb.ident = tr.ident
您不再需要WHERE
条款。