Home » SQL & PL/SQL » SQL & PL/SQL » Self Outer Join query
Self Outer Join query [message #339938] Sat, 09 August 2008 23:42 Go to next message
bztom33
Messages: 95
Registered: June 2005
Member
Is it possible to do a self outer join with the following query?

Columns b.value,b.flag and c.value can be null sometime.



select
 a.date_time,
 a.value,
 b.value,
 b.flag,
 c.value
from 
  forecast_sales a,
  forecast_sales b,
  forecast_sales c
where 
a.op_date ='10/31/2006 08:02' 
and a.op_date = b.op_date
and a.op_date = c.op_date
and a.date_time = b.date_time
and a.date_time = c.date_time
and a.custom_id = 32  
and b.custom_id = 33  
and c.custom_id = 34  
and a.user_id = 1     
and a.user_id = b.user_id
and c.user_id = 2
order by a.date_time

[Updated on: Sat, 09 August 2008 23:49]

Report message to a moderator

Re: Self Outer Join query [message #339939 is a reply to message #339938] Sat, 09 August 2008 23:50 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & FOLLOW the Posting Guidelines in URL above
Re: Self Outer Join query [message #339941 is a reply to message #339938] Sun, 10 August 2008 01:16 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Yes, it is possible.

Regards
Michel
Re: Self Outer Join query [message #339989 is a reply to message #339938] Sun, 10 August 2008 15:55 Go to previous message
gintsp
Messages: 118
Registered: February 2007
Senior Member
Yes why not. Self joins and Outer joins can be completely compatible things Smile
See more about SQL join types here and also one of the examples.

Gints Plivna

[Updated on: Sun, 10 August 2008 23:50] by Moderator

Report message to a moderator

Previous Topic: How to send a mail from PL/sql
Next Topic: schemas
Goto Forum:
  


Current Time: Sat Dec 10 05:06:39 CST 2016

Total time taken to generate the page: 0.08181 seconds