Home > Database > Mysql Tutorial > mysql左连接与oracle(+)使用对照

mysql左连接与oracle(+)使用对照

WBOY
Release: 2016-06-07 16:16:06
Original
1463 people have browsed it

mysql左连接与oracle(+)使用对比 由于mysql不能像oracle一样使用(+)做外连接,使用left join或者right join需要注意 oracle: select a.aid aid , b.bid bid ,c.cid cid , d.did did , e.eid eid from tablea a , tableb b ,tablec c ,tabled d ,tablee e whe

mysql左连接与oracle(+)使用对比
由于mysql不能像oracle一样使用(+)做外连接,使用left join或者right join需要注意
oracle: 
select a.aid aid , b.bid bid ,c.cid cid , d.did did , e.eid eid 
from 
tablea a , 
tableb b ,
tablec c ,
tabled d ,
tablee e 
where
a.aid = b.aid (+)
and a.aid = c.aid(+)
and b.bid = d.bid (+)
and d.did = e.eid (+)
order by a.aid , b.bid , c.cid , d.did ,e.eid
;



mysql:
select a.aid aid , b.bid bid ,c.cid cid , d.did did , e.eid eid 
from 
tablea a left join 
        (
        tableb b left join 
                ( 
                        tabled d left join tablee e 
                        on (d.did = e.eid) 
                )
                on (b.bid = d.bid )  
        )
        on ( a.aid = b.aid)
        left join tablec c 
        on a.aid = c.aid
order by a.aid , b.bid , c.cid , d.did ,e.eid
;

Copy after login

引至http://www.itpub.net/thread-1122562-1-1.html
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template