1.模糊匹配,b表记录不在a表中的

select b.name,a.zymc from a
   left join b
on instr(b.name,a.zymc) >0
where b.name is null

2.根据主副id拼出目录

select c.id_directory_parent,  -- c表副id
         c.id_directory, -- c表主id
         b.id_directory, -- b表主id
         a.id_directory, -- a表主id
case when b.id_directory_parent is null then '/' || a.directory_name
        when c.id_directory_parent is null then '/' || b.directory_name || '/' ||a.directory_name
       else '/' || c.directory_name || '/' || b.directory_name  || '/' || a.directory_name  end as ml
from r_directory a
left join r_directory b
on a.id_directory_parent = b.id_directory
left join r_directory  c
on b.id_directory_parent  = c.id_directory
posted on 2019-01-03 09:44  Tomatoes  阅读(1384)  评论(0编辑  收藏  举报