内部联接的SQL Server问题

时间:2012-07-18 13:54:56

标签: sql sql-server

我当前有这个代码

SELECT JOB.JobID, A.adID, AR.ARNum
FROM dbo.vEvent AS E, dbo.[vAd] as A, dbo.[vAR] as AR, dbo.JOB_EVENT as JOB
INNER JOIN A ON A.eventID = E.eventID
INNER JOIN AR ON AR.eventID = A.eventID
INNER JOIN JOB ON JOB.EVENT_ID = E.eventID
WHERE year = '' AND season = '' AND month = ''

然而;当我在SQl服务器中执行它时,我收到此错误。

Msg 208, Level 16, State 1, Line 1
Invalid object name 'A'.

我不明白,因为我的所有变量对我来说都是正确的。

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:5)

你想要

SELECT JOB.JobID, A.adID, AR.ARNum
FROM dbo.vEvent AS E
INNER JOIN dbo.[vAd] as A ON A.eventID = E.eventID
INNER JOIN dbo.[vAR] as AR ON AR.eventID = A.eventID
INNER JOIN dbo.JOB_EVENT as JOB ON JOB.EVENT_ID = E.eventID
WHERE year = '' AND season = '' AND month = ''