我正在嘗試在 sql 中進行一些簡單的過濾,但沒有成功。
table1
id table2Id table3Id name value
1 null 1 test0 null
2 null 2 test2 null <== i want exclude this line from my result
3 1 2 test2 MOB
當條件為 時,我想從結果中排除table2Id = null and table3Id = 2,但條件在第一個中失敗。
我正在做:
SELECT NAME,VALUE FROM TABLE1 WHERE NOT(table2Id = null AND table3Id = 2)
并得到:
table1
id table2Id table3Id name value
3 1 2 test2 MOB
我想要:
id table2Id table3Id name value
3 1 2 test2 MOB
1 null 1 test0 null
uj5u.com熱心網友回復:
你想要的是:
SELECT NAME,
VALUE
FROM TABLE1
WHERE NOT(table2Id IS null AND table3Id = 2)
uj5u.com熱心網友回復:
您可以只使用 Where Not 陳述句
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/430052.html
