Find min and max for subsets of consecutive rows - gaps and islands
问题 Trying to build a query. The input is ordered by rownumber in column 'rn' starting with 1 for each unique value in 'name' and defining a given sequence of entries in 'act'. In column 'act' it holds two values in multiple occurence, >sleep< and >wake<. The goal is to find for each consecutive set of rows of one of those values the minimum and maximum value of startt and endd. This shall be the input: name act rn startt endd ---------- ---------- ------ ------ ------ jimmy sleep 1 1 3 jimmy