Hi I would like to create a SQL to group the records according to the range
For example, suppose I have
Number Time Price
100 20100810 10.0
100 20100812 15.0
160 20100810 10.0
200 20100810 12.0
210 20100811 13.0
300 20100811 14.0
350 20100810 16.0
Now I need to get the records according to the range of the "Number": [100,200),[200,300),[300,400) and [0,400]
. For each range, I need the "Price" of the lastest "Time"
So the results should be
NumberRange Time Price
1 20100812 15.0
2 20100811 13.0
3 20100811 14.0
4 20100812 15.0
How can I construct a SQL statement to produce this?
I am not working on a specific Database. So I am looking for no specific database SQL statement