select * from (select XXX from XXX) as a inner join(select xxxx from xx) as b where a.xx=b.xx
select * from (select id,pid,khdm,khmc from com_base_kehu where khdm2='DHB003')as a left join (select a.id as 序号,a.org_id,a.yhzdmc,b.pid,b.id,b.zd_id,c.khmc from ipos_yhzdz a inner JOIN ipos_yhzdzmx b on a.id=b.pid INNER JOIN com_base_kehu c on b.zd_id=c.Id where a.org_id='3386' ) as b on a.Id=b.zd_id