select max value in each 5 rows

Viewed 174

My total rows are variable and not fixed , So there are N rows and I want to separate each 5 rows as a group and select the max value of price in following table in SQL.

Date     Price
20170101 100
20170102 110
20170103 90
20170105 80
20170109 76

20170110 50
20170111 55
20170113 80
20170115 100
20170120 99

20170121 88
20170122 98
20170123 120

So in first 5 group the max price is 110 , and second group is 100, and last group max price is 120.

3 Answers
Related