Re: Outer Join
Date: Tue, 15 Feb 2011 15:27:28 +0100
Message-ID: <ije1b4$90n$1_at_srv.cyf-kr.edu.pl>
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ł:
> 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!
Received on Tue Feb 15 2011 - 08:27:28 CST