oracle小记3-left join
select *
from (select row_.*, rownum rownum_
from (select rownum "index", b.*
from (select rownum,
mc.cust_no "cust_no",
c.cust_name "cust_name",
c.cert_type "cert_type",
c.cert_no "cert_no",
c.open_way "open_way",
d.name "jingbanjigou",
od.name "nowogrid",
op.name "nowjingli",
(select case
when mch.old_manager = 'MG0000000000' then
'已移出'
when mch.new_manager = 'MG0000000000' then
'已移入'
end case
from b_oc_manager_cust_his mch
where mch.manager_custhis_id =
mc.manager_custhis_id) as "status"
from b_oc_manager_cust_his mc
left join b_oc_customer c
on mc.cust_no = c.cust_no
left join ec_org_person p
on mc.operator = p.manager_no
left join ec_org_department d
on p.orgid = d.id, ec_org_person op,
ec_org_department od
where mc.operate_type = '1'
and mc.new_manager = op.manager_no
and op.orgid = od.id
and (mc.old_manager = 'MG0000000000' or
mc.new_manager = 'MG0000000000')
order by operate_time desc)b) row_
where rownum < 11)
where rownum_ > 0