Hey folks,
I'm trying to convert a project from Oracle to Mysql 5, and I have a
question about outer join syntax in mysql. In oracle, I can do something
like the below to tell Oracle that on the outer joined table, if there's a
value, I want it to be X. On mySql, all I've been able to figure out is the
second syntax (which works, I think). Is that the preferred method?


ORACLE, NON-STANDARDS COMPLIANT CODE
FROM    fscd_client c, fscd_county x, fscd_state s, fscd_survey u, fscd_post
p
WHERE    c.countyid = x.countyid
AND        x.stateid = s.stateid
AND        c.clientid = u.clientid (+)
AND        c.clientid = p.clientid (+)
AND     c.active = 1
AND        p.active (+) = 1
AND        u.active (+) =  1  <!--- This part here says that if a value
exists, it should be 1 --->

MYSQL VERSION
FROM  (fscd_county x JOIN fscd_client c ON (x.countyid = c.countyid)
      JOIN fscd_state s on (s.stateid = x.stateid))
      LEFT OUTER JOIN fscd_survey u ON c.clientid = u.clientid
      LEFT OUTER JOIN fscd_post p ON c.clientid = p.clientid
WHERE  x.active = 1
AND    c.active = 1
AND    (p.active = 1 OR p.active is null)
AND    (u.active = 1 OR u.active is null) <!--- Is this the preferred method
in Mysql? --->


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:237782
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to