Group consecutive rows that are incremented by 1
问题 Here are my datas : FirstKey SecondKey Sequence A1 B1 10001 A1 B1 10002 A1 B1 10003 A1 B1 10004 A1 B2 10001 A1 B2 10003 A1 B2 10005 A1 B3 10001 A1 B3 10002 A1 B3 10003 A2 B4 20001 A2 B5 20002 A2 B5 20003 A2 B6 20004 I try to output the following result: FirstKey SecondKey StartSequence EndSequence A1 B1 10001 10004 A1 B2 10001 10001 A1 B2 10003 10003 A1 B2 10005 10005 A1 B3 10001 10003 A2 B4 20001 20001 A2 B5 20002 20003 A2 B6 20004 20004 Sequence is an integer, not a varchar. I want