473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 5930
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin | last post by:
I am now working on SQL Server 2000 having had previous experience on a different database. Both of the OUTER JOIN syntaxes is different from what I am used to and I am finding it slightly...
3
by: mheydman | last post by:
I apologize if this has been asked before- I searched google but could not find a concrete answer. I recently inherited a database whose t-sql code is written in a format that I find difficult...
8
by: Matt | last post by:
Hello I have to tables ar and arb, ar holds articles and a swedish description, arb holds descriptions in other languages. I want to retreive all articles that match a criteria from ar and...
4
by: Anthony Robinson | last post by:
I was actually just wondering if someone could possibly take a look and tell me what I may be doing wrong in this query? I keep getting ambiguous column errors and have no idea why...? Thanks in...
3
by: Ian Boyd | last post by:
i know nothing about DB2, but i'm sure this must be possible. i'm trying to get a client to create a view (which it turns out is called a "Logical" in DB2). The query needs a LEFT OUTER JOIN, but...
3
by: deko | last post by:
From what I understand, an Inner Join narrow the rows selected to the table with the least results... and an Outer Join does the opposite... SELECT qryTxToQ1.Q1Total, qryTxToQ2.Q2Total,...
5
by: Dev | last post by:
Hello all, I need to do a left out join where a.field1 ilike %b.field2% But I can not figure out the exact syntax to using the ilike in the join? ----------
3
by: Doug | last post by:
Hi, I'm more familiar with MSSQL than Access syntax and have run into a problem with correctly putting ( )'s around the joins in a 3 table query. I want to INNER JOIN lenders and accounts and...
5
by: Eitan M | last post by:
Hello, How can I do outer join in ms-access database ? Thanks :)
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.