RE: [PHP-DB] mysql and oracle outer join syntax
| From: | Matthew Loff | Date: | Tue, 24 Jul 2001 20:31:55 +0000 |
| Subject: | RE: [PHP-DB] mysql and oracle outer join syntax | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10722@lists.php.net to get a copy of this message | ||
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@lissajous.com]
Sent: Tuesday, July 24, 2001 2:02 PM
To: php-db@lists.php.net
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@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net