SELECT * FROM Questions
INNER JOIN QuestionKeyword INNER JOIN Keywords
ON Questions.ID=QuestionKeyword.QuestionID
AND QuestionKeyword.KeywordID=Keywords.ID
WHERE Keywords.Keyword LIKE '%es%'
Run Code Online (Sandbox Code Playgroud)
它说:关键字'WHERE'附近的语法不正确.
您无法组合来自多个JOIN的条件,但必须使用每个连接单独列出它们:
SELECT * FROM Questions
INNER JOIN QuestionKeyword ON Questions.ID=QuestionKeyword.QuestionID
INNER JOIN Keywords ON QuestionKeyword.KeywordID=Keywords.ID
WHERE Keywords.Keyword LIKE '%es%'
Run Code Online (Sandbox Code Playgroud)