Num
1
2
4
6
7
8
10
11
13
写条SQL语句转成下表:
Column1 Column2
1 2
4 4
6 8
10 11
13 13
selectMIN(Num),MAX(Num)from
(selectROW_NUMBER()over (orderbyNum)rk,Num
FromNumbers)A
Groupby (A.rk-A.Num)
orderbyMin(Num)
Num
1
2
4
6
7
8
10
11
13
写条SQL语句转成下表:
Column1 Column2
1 2
4 4
6 8
10 11
13 13
selectMIN(Num),MAX(Num)from
(selectROW_NUMBER()over (orderbyNum)rk,Num
FromNumbers)A
Groupby (A.rk-A.Num)
orderbyMin(Num)