I have this table
ID Level Value
1 1 10
1 2 20
1 3 15
1 4 18
2 2 12
2 1 20
3 1 50
3 2 80
I want find the max level for each id and the value of this max row, Result :
ID Level Value
1 4 18
2 2 12
3 2 80
I don’t want use nested ‘Select’ because my table is too big and nested select slow down my query
Thanks for any help
You can do this with a self-join and a test for null.