0
It is a matter of logic and knowledge of Postgresql resources. I have the following result of a query:
I need to do a filtering, grouping by [hour] so that only the nearest [real time] remains and, consequently, the whole row corresponding (I have a series of other columns).
I started trying to solve by calculating the absolute value of the difference in seconds. However, grouping by hour and calculating the minimum value of the [dif_abs] column, how to ensure that the other values of the corresponding row remain? Since I cannot use an aggregator, it might not correspond in some cases.
In this case, should only the line with dif_abs 45 remain? Put the expected result and with more values if possible.
– Murillo Goulart
Murillo, got with DISTINCT ON. I will post the reply. Thank you!
– Paulo Vitor