php-db | 2001072

RE: [PHP-DB] mysql and oracle outer join syntax From: Matthew Loff (matt <email protected>)
Date: 07/24/01

In Oracle, the syntax for a theta-style join (the one you're describing)
is:

SELECT ...
FROM ...
WHERE item1 (+) = item2

However, MySQL doesn't support this syntax. The only way to do left
(outer) joins in mysql is the way you described:

SELECT ...
FROM ...
LEFT JOIN ... ON ... = ...

-----Original Message-----
From: alvin townsend [mailto:alvin <email protected>]
Sent: Tuesday, July 24, 2001 2:02 PM
To: php-db <email protected>
Subject: [PHP-DB] mysql and oracle outer join syntax

hello all.

i have a question - but first some background...

the standard LEFT JOIN syntax is something like this:

SELECT t1.a, t1.b, t1.c, t2.d, t2.e
FROM table1 t1 LEFT JOIN table2 t2 ON t1.x = t2.x
WHERE t1.a = 'some condition or another';

i much prefer to do LEFT JOINs like this however:

SELECT t1.a, t1.b, t1.c, t2.d, t2.e
FROM table1 t1, table2 t2
WHERE t1.x = t2.x
AND t1.a = 'some condition or another';

however, now i've got to convert this to an OUTER JOIN. i know that with
oracle, you can add a plus somewhere like this (although i'm unclear
what the precise syntax is):

SELECT t1.a, t1.b, t1.c, t2.d, t2.e
FROM table1 t1, table2 t2
WHERE t1.x = t2.x+ [note the plus here]
AND t1.a = 'some condition or another';

and now the question....

does anyone know if there's a way with mysql to use the oracle-esqe + to
do an OUTER JOIN so i don't have to go back and rewrite all of my sql
statements?

thanks a lot!

alvin

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>