Home » SQL & PL/SQL » SQL & PL/SQL » outer join help...
outer join help... [message #20056] Fri, 26 April 2002 15:04 Go to next message
shreya
Messages: 15
Registered: March 2001
Junior Member
Hi,

Here is my quey.

DROP TABLE my_acc_table;
CREATE TABLE my_acc_table AS
SELECT a.*
FROM schma1.user_table@x1 a,
schma2.user_table@x2 b
WHERE
a.start_date = '01-jan-02'
and b.start_date = '01-jan-02'
and a.user_id = b.user_id
and ABS(a.amount-b.amount) /
DECODE(a.amount,0,1,a.amount) >= 0.05;

I have to write outer join for this query.
user_id's may be different in both the schema.

I need both the left and the right outer join for this query.
If anyone knows how to do it please send it.
I would be very thankful to u.

Regards,
Sushma.
Re: outer join help... [message #20059 is a reply to message #20056] Fri, 26 April 2002 21:08 Go to previous message
Saga
Messages: 51
Registered: April 2002
Member

Lets first look at outer join implementation
Rule 1: Outer join(+) applies to side(column) which is deficient in data.
Rule 2: Outer join is applied to only one side in a given condition be it left side or right side.You can apply it to either left or right side in a condition but not to both.
example

and a = b(+)
and c(+) = d
is correct

But
and a(+) = b(+) --wrong
and c(+) = d
is not

Hope it will help.
Previous Topic: How to???
Next Topic: Using outer join with a subquery
Goto Forum:
  


Current Time: Fri Apr 19 05:30:51 CDT 2024