0 - 2 of 2 tags for general udf

Hi everybody,
 

HOw could I take an average of two values by arranging the data in ascending order using SQL. For example

For the Col "Var1" with data

TrackId Var1
1 1.2
2 1.1
3 1.5
4 1.6
5 1.3