select *
from dict_organ_info o
where o.flag = '1'
and o.district_belong like '%222404%'
and( o.higher_organ = '1'
or
o.higher_organ not in
( select a.organ_id
from dict_organ_info a
where a.flag = '1'
and a.district_belong like '%222404%'
)
)
select *
from dict_organ_info o
where o.flag = '1'
and o.district_belong like '222404%'
and trim(o.higher_organ) not in
( select trim(a.organ_id)
from dict_organ_info a
where a.flag = '1'
and a.district_belong like '222404%'
)
from dict_organ_info o
where o.flag = '1'
and o.district_belong like '%222404%'
and( o.higher_organ = '1'
or
o.higher_organ not in
( select a.organ_id
from dict_organ_info a
where a.flag = '1'
and a.district_belong like '%222404%'
)
)
select *
from dict_organ_info o
where o.flag = '1'
and o.district_belong like '222404%'
and trim(o.higher_organ) not in
( select trim(a.organ_id)
from dict_organ_info a
where a.flag = '1'
and a.district_belong like '222404%'
)