我在将以下两个陈述合并时遇到困难。我需要查询语句1或语句2.我无法弄清楚如何在两者之间添加OR语句。 #标准-SQL
声明1
WHERE
(feedback IS NOT NULL OR text IS NOT NULL)
AND rating <= 2
声明2
WHERE
(rating = 3 OR rating = 4)
AND feedback IS NOT NULL
理想的结果是这样的......
WHERE
(feedback IS NOT NULL OR text IS NOT NULL)
AND rating <= 2
OR
(rating = 3 OR rating = 4)
AND feedback IS NOT NULL
答案 0 :(得分:2)
在括号中封装两个完整条件:
WHERE
(
(feedback IS NOT NULL OR text IS NOT NULL)
AND rating <= 2
)
OR
(
(rating = 3 OR rating = 4)
AND feedback IS NOT NULL
)