我有一个表作业,其StartDate列通常为null.如果它不是null,那么这就是我想要与表格四分之一的内部联接,否则我想在其他条件下进行内部联接.这就是我想要的东西:
INNER JOIN Quarters q
ON (IF j.StartDate IS NOT NULL (j. StartDate BETWEEN GETDATE() and q.EndDate)
ELSE **Some other condition**)
Run Code Online (Sandbox Code Playgroud)
运行此错误时出现的错误是关键字"IF"附近的语法不正确
有谁知道这个的正确语法?
在此先感谢您的帮助!
INNER JOIN Quarters q ON
(j.StartDate IS NOT NULL AND j. StartDate BETWEEN GETDATE() and q.EndDate)
OR
(j.StartDate IS NULL AND **Some other condition**)
Run Code Online (Sandbox Code Playgroud)