Skip to content
Advertisement

Oracle max function on timestamp datatype

I want to take a max date from a timestamp datatype in oracle

my data look like this

Since all the date are same but timestamp is difference the max function bringing all the 3 rows instead i want to see the max date with latest timestamp for each ID like below

thanks in advance

The table as 10000 plus rows, the data looks like below

On select i want to see 1 row per id no duplicates Select MAX(updated_date) update_date, id FROM id_table group by id;

Advertisement

Answer

You may use the FIRST aggregate function or row_number().

1.

2.

Demo

Bonus ( for Oracle 12c and above) :

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement