select * from table t1 where not exists(select 1 from t t2 where t2.name="张三" and t2.dept='业务部' and t1.name=t2 and t1.dept=t2.dept)

解决方案 »

  1.   

    1 <> :
    select * from table t where t.name <> '张三' and t.dept='业务部';2 not in:
    select * from table t where t.name not in ('张三') and t.dept='业务部';3 not exists:
    select * from table t where t.dept='业务部'
    and not exists (select 1 from table tt where tt.id=t.id and tt.name='张三' );
      

  2.   

    select * from t_name t where t.name not in ('xxx') and t.dept='xxx';
    或者
    select * from t_name t where t.name !='xxxx' and t.dept='xxx'
      

  3.   

    !(A且B)=!A或!B。有那么复杂么?
      

  4.   

    select * from table t where (t.name  , t.dept) <>("张三",'业务部')如果这个不行的话 用
    select * from table t where (t.name  , t.dept) <>(select  "张三",'业务部' from dual )如果还不行的话 用 
    select * from table t where (t.name  , t.dept)  not in("张三",'业务部')
    或者
    select * from table t where (t.name  , t.dept) not in (select  "张三",'业务部' from dual )