create view viewname as select * from tablename where (B not in (select distinct B from tablename where C=3)) or (C=3 and B in (select distinct B from tablename where C=3))
在判定条件的时候,加入or,就可以判定了
在判定条件的时候,加入or,就可以判定了
from yourtable t0
where c=3 or not exists (select t1.c
from yourtable t1
where t0.a=t1.a and t0.b=t1.b and t1.c=3)
from yourtable t0
where t0.c=3 or not exists (select t1.c
from yourtable t1
where t1.a=t0.a and t1.b=t0.b and t1.c=3)
from yourtable t0
where t0.c=3
or not exists (select t1.*
from yourtable t1
where t1.a=t0.a and t1.b=t0.b and t1.c=3)