미리 감사드립니다,
with tableA as (
select 1 as ID, 0 as sort_order, 'A' as title from dual union all
select 5 as ID, 0 as sort_order, 'A1' as title from dual union all
select 6 as ID, 0 as sort_order, 'A2' as title from dual union all
select 7 as ID, 0 as sort_order, 'A2' as title from dual union all
select 7 as ID, 0 as sort_order, 'A3' as title from dual union all
select 2 as ID, 2 as sort_order, 'B' as title from dual union all
select 3 as ID, 3 as sort_order, 'B1' as title from dual union all
select 4 as ID, 4 as sort_order, 'B2' as title from dual
)
select ROW_NUMBER() OVER(ORDER BY sort_order,title) as rowno,title,id,sort_order
from tableA
결과_1
rowno,title,id,sort_order
1 A 1 0
2 A1 5 0
3 A2 6 0
4 A2 7 0
5 A3 7 0
6 B 2 2
7 B1 3 3
8 B2 4 4
결과_1에서 rowno=5인 행을 드래그하여 rownor=3위치로 이동한 경우 sort_oder를 변경하고자 합니다.
rowno=3 이후의 데이터를 조회 하여, sort_order를 업데이트 하려고 합니다.
여기서 rowno=3(id=6) 이후의 데이터를 조회하는 방법이 있을까요?
|