Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(+) syntax for outer joins in mysql [duplicate]

Possible Duplicates:
Oracle “(+)” Operator
Oracle (Old?) Joins - A tool/script for conversion?

I have been somewhat spoiled by using Oracle for years. Now I am using mysql and cannot find a non-ansi version/shorthand version of outer joins in MySQL.

In oracle I could do this

select a.country acountry,
        a.stateProvince aStateProvince,
        b.countryName bcountry,
        b.name bstateProvince
  from User a,
          stateprovince b
  where a.country*=b.countryName **(+)**
          and a.stateProvince*=b.name **(+)**

to get an outer join. Can mysql do something similar?

like image 418
benstpierre Avatar asked Jul 12 '11 00:07

benstpierre


1 Answers

Simpler than this:

select a.country acountry,
        a.stateProvince aStateProvince,
        b.countryName bcountry,
        b.name bstateProvince
  from User a
        left join
          stateprovince b
    on  a.country = b.countryName 
          and a.stateProvince = b.name 

No.

like image 167
ypercubeᵀᴹ Avatar answered Sep 20 '22 00:09

ypercubeᵀᴹ