如果我取出 WHERE 子句,Join 乍一看似乎工作正常......并且 imageID 485 确实存在......但是,当我在WHERE
下面插入子句时,我返回 0 结果。
如何添加WHERE
子句以正确处理 3 个表的加入?
declare @imageID int
set @imageID = 485
SELECT Movie.movieID, Image.imageID, Image.filename, Image.imageFile
FROM MovieHasImage
JOIN Movie
ON MovieHasImage.movieID = Movie.movieID
JOIN Image
ON MovieHasImage.imageID = Image.imageID
WHERE Image.imageID = @imageID --HERE IS THE CAUSE OF THE ISSUE
GO