Re: Examples of real usage of outer joins?
- From: Lew <lew@xxxxxxxxxxxxxxxx>
- Date: Sat, 04 Aug 2007 17:07:09 -0400
david.karr wrote:
This is more of a general database question, not specific to Java, but
can someone describe an actual realistic use of outer joins? I'm
familiar with how it works, and some trivial examples, but I'm frankly
unsure of why you'd actually need to use it.
Example:
You want a list of all customers and their outstanding orders, but they might not have any orders at the moment:
SELECT c.name, o.ordernum, o.total
FROM customers c LEFT OUTER JOIN orders o
ON c.name = o.cust_name
ORDER BY c.name, o.ordernum;
You don't want to omit a customer from the report just because they haven't ordered something today.
--
Lew
.
- Follow-Ups:
- Re: Examples of real usage of outer joins?
- From: Shy
- Re: Examples of real usage of outer joins?
- From: dimov.vlatko@xxxxxxxxx
- Re: Examples of real usage of outer joins?
- References:
- Examples of real usage of outer joins?
- From: david.karr
- Examples of real usage of outer joins?
- Prev by Date: Examples of real usage of outer joins?
- Next by Date: Re: Examples of real usage of outer joins?
- Previous by thread: Examples of real usage of outer joins?
- Next by thread: Re: Examples of real usage of outer joins?
- Index(es):
Relevant Pages
|
|