我得到的查询结果不同,唯一的区别是where条件的顺序不同。这可能是因为源表出了问题。
SELECT *
FROM source
WHERE ((submission <> 'Y' or submission is NULL) and payment >0.01)
OR (submission='Y' and payment_2 > 0.01);
Result 1:
+----------+-------------+-------------+------------+----------+
| Name | entry | submission | payment_2 | payment |
+------------------------------+-------------+-----------------+
| abc | 1 | NULL | 0.0 | 790.5 |
+----------+-------------+-------------+------------+----------+
Query 2:
SELECT *
FROM source
WHERE (submission='Y' and payment_2 > 0.01)
OR ((submission <> 'Y' or submission is NULL) and payment >0.01);
Result 2:
+----------+-------------+-------------+------------+----------+
| Name | entry | submission | payment_2 | payment |
+------------------------------+-------------+-----------------+
+----------+-------------+-------------+------------+----------+```
暂无答案!
目前还没有任何答案,快来回答吧!