SQL 查询 WHERE 过滤器独占
SQL query WHERE filter exclusive
我正在尝试在 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
你想要的是:
SELECT NAME,
VALUE
FROM TABLE1
WHERE NOT(table2Id IS null AND table3Id = 2)
我正在尝试在 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
你想要的是:
SELECT NAME,
VALUE
FROM TABLE1
WHERE NOT(table2Id IS null AND table3Id = 2)