I have a table like This:
ID (Not PK) | time_to_prioritize | extra_info_1 | extra_info_2 |
---|---|---|---|
001 | 0 | info_1 | info_1 |
001 | 1 | info_1 | info_1 |
001 | 2 | info_1_last | info_1_last |
002 | 1 | info_2 | info_2 |
002 | 2 | info_2_last | info_2_last |
003 | 0 | info_3_last | info_3_last |
My objective is to get the max(time_to_prioritize) of all distinct ID's along with the extra columns, like this:
ID (Not PK) | time_to_prioritize | extra_info_1 | extra_info_2 |
---|---|---|---|
001 | 2 | info_1_last | info_1_last |
002 | 2 | info_2_last | info_2_last |
003 | 0 | info_3_last | info_3_last |
I got stuck at
SELECT TOP 1 * FROM my_table
ORDER BY time_to_prioritize DESC
I am trying to join it with itself, but with no results. What is the next step to achieve the result ? thanks.
P.S. the result on SQL MAX of multiple columns? does not help me, bc that link is the max of every column, I need the max of only 1 column, along with the rest of the data