I have following data in postgres:
index | item |
------+--------
10 | aaa |
20 | aaa |
30 | bbb |
40 | aaa |
50 | aaa |
I would like to group it and get the minimum and maximum value. However, it only should group until next row is different item.
Expectation:
indexMin | indexMax | item |
---------+----------+----------
10 | 20 | aaa |
30 | 30 | bbb |
40 | 50 | aaa |
Can guide on this?