现在有两个表A,B通过code一对一关联
A表结构如下
code orgcity destcity B表结构如下 code status1 status2 status3
status1,status2,status3的值有可能为0,1,-1
现在我想查找status1,status2,status3同时不为-1,1,1或-1,-1,1或-1,-1,-1或1,1,1或1,-1,1或1,-1,-1这六种情况下的orgcity与destcity,不知道PL/SQL怎么写?
A表结构如下
code orgcity destcity B表结构如下 code status1 status2 status3
status1,status2,status3的值有可能为0,1,-1
现在我想查找status1,status2,status3同时不为-1,1,1或-1,-1,1或-1,-1,-1或1,1,1或1,-1,1或1,-1,-1这六种情况下的orgcity与destcity,不知道PL/SQL怎么写?
where code not in(
select code from b
where (status1=-1 and status2=1 and status3=1)
or (status1=-1 and status2=-1 and status3=1)
or (status1=-1 and status2=-1 and status3=-1)
or (status1=1 and status2=-1 and status3=1)
or (status1=1 and status2=-1 and status3=-1));