日期:2014-05-17 浏览次数:20713 次
with t(a,b) as( select 'FLAG','tang' from dual union select 'FLAG','song' from dual union select 'OTHER','song' from dual ) select b from t where a='FLAG' and not exists (select * from t t1 where t1.b=t.b and t1.a<>'FLAG'); /* B ------ tang */
------解决方案--------------------
不好意思发错了
select a.字段A, a.字段B from tmptb a where a.字段B not in (select 字段B from tmptb where 字段A <> 'FLAG') and a.字段A='FLAG'