假设我有
ID | Column 1 | Column 2
2 | NULL | "a"
3 | "b" | NULL
4 | "c" | "c"
我想写的是这样的:
SELECT ID FROM table, AnotherTable
WHERE (Table.Column1 = AnotherTable.Column IF Table.Column1 IS NOT NULL
OR Table.Column2 = AnotherTable.Column IF Table.Column2 IS NOT NULL)
编辑:我还添加了案例 IF Table.Column1 IS NOT NULL AND Table.Column2 IS NOT NULL THEN CHOOSE Table.Column2 = AnotherTable.Column