Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: cursor definition query
In article <39789f5f.19486749_at_news.harvard.edu>,
hoke_at_gse.harvard.edu (Ken Ho) wrote:
> If I have a table whose columns are:
>
> customer_ID varchar2(4)
> visit_date date
>
> and each customer has 1 or more visits, how would I select a single
> row for each customer_ID, with the stipulation that I must have the
> row with the most recent visit_date value?
>
SELECT customer_id, max(visit_date)
from T
group by customer_id
/
-- Thomas Kyte (tkyte_at_us.oracle.com) Oracle Service Industries Howtos and such: http://osi.oracle.com/~tkyte/index.html Oracle Magazine: http://www.oracle.com/oramag Opinions are mine and do not necessarily reflect those of Oracle Corp Sent via Deja.com http://www.deja.com/ Before you buy.Received on Fri Jul 21 2000 - 00:00:00 CDT
![]() |
![]() |