Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Select statement child - parent
In my example I have database with two tables:
customer contains the columns cust_id, name, address
sales contains the columns sales_id, date, value, text
When I do a
select
c.name, s.date
from
customer c, sales s
where
c.cust_id=s.cust_id and s.date = (select max(date) from sales ss where ss.cust_is=c.cust_id )
it returns all customer name and last salesdate if they have any childrecord in tables "sales" like this:
c.name s.date bush 03/03/2003 jameson 02/01/2003 More 07/06/2002
So far, so good. But is it possible with a single query to return ALL customers from table customer (indepent however they have child or not) and last date if there are a child present like this:
c.name s.date Bush 03/03/2003 Nicholson Jameson 02/01/2003 More 07/06/2002
Best regards
Yngve Received on Fri Sep 05 2003 - 12:45:07 CDT