select * from table where a = 1 or b = 2 如果是A != 1 and B != 2的话 select * from table where a <> 1 and b <> 2 where not(A!=1 and B!=2)
这样子OK! 各位: 请看好了,是A != 1 同时 B!= 2 以外的情况 A != 1 and B!= 2 它的反义就是: A = 1 or B = 2 你的描述存在歧义 如果是“求A != 1” and“ B != 2 以外的记录” 条件就写 where a!=1 and not(b!=2) 当然你也可以写成where a!=1 and b=2 你根据需要修改下 A != 1 同时 B!= 2 以外的情况
情况1: (A != 1 同时 B!= 2)以外的情况,则 a = 1 or b = 2 or a is null or b is null;
情况2: A != 1 同时 (B!= 2以外)的情况,则 a != 1 and (b = 2 or b is null);
SQL> col deptno format a10 heading "编号" SQL> select * from dept; 编号 部门 LOC ---------- ---------- ------------- ########## ACCOUNTING NEW YORK ##### ......