Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

finding max value of a column attached with timestamp

user8427026Jun 20 2016 — edited Jun 20 2016

I have a db

    

    name                                                                 age                        date

adl-0147.0006/19/2016 08:30:00
adl-0147.0006/19/2016 09:45:00
adl-0146.0006/19/2016 16:00:00
rtdl-0145.0006/19/2016 07:00:00
erdl-0145.0006/19/2016 10:00:00
adl-0145.0006/19/2016 12:00:00
tydl-0145.0006/19/2016 09:30:00

I want to find max age for a all distinct name with linked time stamp. But whenever I'm grouping by date column, it just gives all values. Without date, I'm able to get desired output but I need the time-stamp attached with the max age for that name.

SELECT name,MAX(age),date FROM pop

WHERE name LIKE '%dl%'

AND date >= TO_DATE('2016-06-19 00:00:00','YYYY-MM-DD HH24:MI:SS')

AND date <= TO_DATE('2016-06-20 00:00:00','YYYY-MM-DD HH24:MI:SS')

GROUP BY name ,date

order by 1,3

Any help plz?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 18 2016
Added on Jun 20 2016
8 comments
2,896 views