Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple How To: SQL left Join with and clause
joes_at_bluewin.ch (joes) wrote in message news:<26760a3e.0402240024.cb53279_at_posting.google.com>...
> SELECT * FROM client, order WEHER client.id = order.clientid(+)
> and order.price < 10.0
Your statement means the following :
SELECT * FROM client, order
WHERE client.id = order.clientid
AND order.price < 10.0
That is, you have negated the effect of the outer join completely.
So you can do as suggested :
SELECT * FROM client, order
WHERE client.id = order.clientid(+)
AND (order.price < 10.0 OR order.price IS NULL)
But an easier way is to to this :
SELECT * FROM client, order
WHERE order.clientid(+) = client.id
AND order.price(+) < 10.0
By putting (+) on BOTH predicates, you will get the outer join you expect.
/KiBeHa Received on Wed Feb 25 2004 - 03:42:32 CST