Thursday, October 29, 2015

Group the sequential records, like continuous days or weeks etc

Create a date group by subtracting value generated by row_number function over a group

Sequential_Col - Row_Number() Over(Partition By Col_1, Col_2 Order by Sequential_Col)

for example


No comments:

Post a Comment