I have got the set of data as follow
temperature
-----------
10
20
30
20
30
20
10
I'm trying to get this result
temperature row_num
-------------------------
10 1
20 2
30 3
20 1
30 2
20 1
10 1
Reset row_number
when the temperature is less than the previous value.
Please help!