Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL question
select c.customer_number, c.customer_name, max(t.access_date)
from customers c, transactions t
where c.customer_number = t.customer_number (+)
group by c.customer_number, c.customer_name
/
tzad
uncle tzad's house o' SQL
Ron Schnell <ronnie_at_space.mit.edu> wrote in article
<6ebhb4$qk1_at_senator-bedfellow.MIT.EDU>...
>
> Hi,
>
> I'm a beginner at SQL, but thought I had a good handle on things, until
> this report problem came up. It seems like it should be possible, but
> I can't figure out how to do it. Is it possible with one query?
>
> Here is a simplified version of the problem:
>
> I have 2 tables, one called 'customer' and one called 'transactions'.
> The customer table has customer numbers and last names of customers, and
> the transaction table has customer numbers and dates for each time each
> customer has used the "system" (one row for each access).
>
> I would like to create a report to print out the name of each customer
> and the last time they accessed the system. Note that some of the
> customers have never accessed the system, but I still want to print out
> their name (and blank or something else in the last access column).
>
> Seems like it should be easy, but I can't figure it out.
>
> Any help would be appreciated.
>
> Sincerely,
>
> #Ron
> ronnie_at_space.mit.edu
>
Received on Fri Mar 13 1998 - 00:00:00 CST
![]() |
![]() |