Skip to content
Advertisement

Postgresql Get Maximum value per day with corresponding time

I have the following table:

I want to get maximum value along with Date,ReceivedTime.

Expected Result:

Advertisement

Answer

This answer assumes that, in the event of two or more records being tied on a given day for the same highest value, you want to retain the single record with the most recent ReceivedTime. We can use DISTINCT ON here:

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