471,354 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

SQL outer join syntax error

I'm not kidding, the only reason yesterday you didn't hear from me was
because I wasn't coding, but today I am doing something quick, and yes, as
always it failed.. right at the SQL statement:
$sql = 'SELECT v.nnet_produkt_varegruppe_navn, ' .
' f.nnet_produkt_farge_navn, ' .
' s.nnet_produkt_storrelse_navn, ' .
' k.nnet_produkt_kvalitet_navn, ' .
' p.* ' .
'FROM nnet_produkt p, nnet_produkt_varegruppe v, ' .
' nnet_produkt_kvalitet k, nnet_produkt_storrelse s ' .
'WHERE p.nnet_produkt_varegruppe_code =
v.nnet_produkt_varegruppe_code ' .
' AND p.nnet_produkt_farge_code = f.nnet_produkt_farge_code ' .
' AND p.nnet_produkt_storrelse_id (+) =
s.nnet_produkt_storrelse_id ' .
' AND p.nnet_produkt_kvalitet_id (+) =
k.nnet_produkt_kvalitet_id';

I am getting "invalid SQL near (+). That is totally VALID SQL syntax for an
outer join! If mySQL doesn't allow for that, what am I supposed to do in
lieu of the fact that I have to logically join two tables together or if the
one is null (the case for an outer join)?

Phil
Jul 16 '05 #1
3 5854
I don't believe the (+) syntax is valid in MySQL. I've used it many
times in Oracle, but in MySQL you have to spell out "LEFT JOIN" etc.

Take a look at http://www.mysql.com/doc/en/JOIN.html for examples.

HTH
-Kurt
http://www.quanetic.com

Phil Powell wrote:
I'm not kidding, the only reason yesterday you didn't hear from me was
because I wasn't coding, but today I am doing something quick, and yes, as
always it failed.. right at the SQL statement:
$sql = 'SELECT v.nnet_produkt_varegruppe_navn, ' .
' f.nnet_produkt_farge_navn, ' .
' s.nnet_produkt_storrelse_navn, ' .
' k.nnet_produkt_kvalitet_navn, ' .
' p.* ' .
'FROM nnet_produkt p, nnet_produkt_varegruppe v, ' .
' nnet_produkt_kvalitet k, nnet_produkt_storrelse s ' .
'WHERE p.nnet_produkt_varegruppe_code =
v.nnet_produkt_varegruppe_code ' .
' AND p.nnet_produkt_farge_code = f.nnet_produkt_farge_code ' .
' AND p.nnet_produkt_storrelse_id (+) =
s.nnet_produkt_storrelse_id ' .
' AND p.nnet_produkt_kvalitet_id (+) =
k.nnet_produkt_kvalitet_id';

I am getting "invalid SQL near (+). That is totally VALID SQL syntax for an
outer join! If mySQL doesn't allow for that, what am I supposed to do in
lieu of the fact that I have to logically join two tables together or if the
one is null (the case for an outer join)?

Phil


Jul 16 '05 #2
On Fri, 12 Sep 2003 16:28:01 -0400, "Phil Powell" <so*****@erols.com> wrote:
I am getting "invalid SQL near (+). That is totally VALID SQL syntax for an
outer join! If mySQL doesn't allow for that, what am I supposed to do in
lieu of the fact that I have to logically join two tables together or if the
one is null (the case for an outer join)?


(+) is Oracle's outer join syntax, prior to Oracle 9i. 9i now supports the
ANSI syntax as well, i.e.

SELECT ... FROM table1 LEFT OUTER JOIN table2 ON (...)

Join syntax is described in the MYSQL manual, of course:
http://www.mysql.com/doc/en/JOIN.html

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 16 '05 #3
Sorry my SQL training is solely based on Oracle 7i and 8i terminology. I
got the SQL query working, just have never seen ANSI syntax before.

Phil

"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:4v********************************@4ax.com...
On Fri, 12 Sep 2003 16:28:01 -0400, "Phil Powell" <so*****@erols.com> wrote:
I am getting "invalid SQL near (+). That is totally VALID SQL syntax for anouter join! If mySQL doesn't allow for that, what am I supposed to do in
lieu of the fact that I have to logically join two tables together or if theone is null (the case for an outer join)?
(+) is Oracle's outer join syntax, prior to Oracle 9i. 9i now supports

the ANSI syntax as well, i.e.

SELECT ... FROM table1 LEFT OUTER JOIN table2 ON (...)

Join syntax is described in the MYSQL manual, of course:
http://www.mysql.com/doc/en/JOIN.html

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

Jul 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Martin | last post: by
8 posts views Thread by Matt | last post: by
4 posts views Thread by Anthony Robinson | last post: by
3 posts views Thread by Ian Boyd | last post: by
5 posts views Thread by Dev | last post: by
5 posts views Thread by Eitan M | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.