473,372 Members | 1,088 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,372 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 5928
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.