回答編集履歴
2
調整
test
CHANGED
@@ -30,12 +30,12 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
-
select id,flg,
|
33
|
+
select id,flg,
|
34
34
|
|
35
|
-
(select t1.id-coalesce(max(id),0) from tbl where flg=0 and id<t1.id)
|
35
|
+
(select case t1.flg when 0 then 1 else t1.id-coalesce(max(id),0) end from tbl where flg=0 and id<t1.id) as max_id
|
36
|
-
|
37
|
-
end as row_number
|
38
36
|
|
39
37
|
from tbl as t1
|
40
38
|
|
41
39
|
```
|
40
|
+
|
41
|
+
※チョット調整しました
|
1
chousei
test
CHANGED
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
(select t1.id-coalesce(max(id),0) from tbl where flg=0 and id<t1.id)
|
36
36
|
|
37
|
-
end as m
|
37
|
+
end as row_number
|
38
38
|
|
39
39
|
from tbl as t1
|
40
40
|
|