dbTalk Databases Forums  

Outer Join

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Outer Join in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
The Magnet
 
Posts: n/a

Default Outer Join - 02-10-2011 , 09:38 AM






Hi,

Been trying for a couple of hours to do this. Here is my query:

SELECT data..........
FROM customer c, customer_account ca, customer_address cd,
customer_order co, order_details od
WHERE c.customer_id = ca.customer_id(+)
AND c.customer_id = cd.customer_id(+)
AND c.customer_id = co.customer_id(+)
AND co.order_id = od.order_id;

The idea is this:
- The customer may or many not have an account record (outer join)
- The customer may or may not have an address record (outer join)
- The customer may or may not have an order record (outer join)

BUT, if the customer DOES have an order record, then he WILL have an
order details record.

Not sure how to code that. Can anyone help? I'm going to keep
trying.......

Thanks!

Reply With Quote
  #2  
Old   
Gerard H. Pille
 
Posts: n/a

Default Re: Outer Join - 02-10-2011 , 12:31 PM






The Magnet wrote:
Quote:
AND co.order_id = od.order_id;
AND co.order_id = od.order_id(+)

Reply With Quote
  #3  
Old   
news.cyf-kr.edu.pl
 
Posts: n/a

Default Re: Outer Join - 02-15-2011 , 08:27 AM



Hi,

Maybe something like this:

SELECT data..........
FROM customer c, customer_account ca, customer_address cd,
(select co.customer_id, co.order_id, .... from customer_order co,
order_details od where co.order_id= od.order_id) cod
WHERE c.customer_id = ca.customer_id(+)
AND c.customer_id = cd.customer_id(+)
AND c.customer_id = cod.customer_id(+)
;

Regards,

Użytkownik The Magnet napisał:
Quote:
Hi,

Been trying for a couple of hours to do this. Here is my query:

SELECT data..........
FROM customer c, customer_account ca, customer_address cd,
customer_order co, order_details od
WHERE c.customer_id = ca.customer_id(+)
AND c.customer_id = cd.customer_id(+)
AND c.customer_id = co.customer_id(+)
AND co.order_id = od.order_id;

The idea is this:
- The customer may or many not have an account record (outer join)
- The customer may or may not have an address record (outer join)
- The customer may or may not have an order record (outer join)

BUT, if the customer DOES have an order record, then he WILL have an
order details record.

Not sure how to code that. Can anyone help? I'm going to keep
trying.......

Thanks!

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.