with TMP_T as ( select 1 as no,'T' as nm from dual union all select 1 as no,'A' as nm from dual union all select 3 as no,'B' as nm from dual union all select 4 as no,'C' as nm from dual union all select 5 as no,'D' as nm from dual union all select 6 as no,'E' as nm from dual ) select (SELECT MAX(NO) +1 from TMP_T),NM from TMP_T where no = 1
제가 원하는 결과는
7 T
8 A 라는 결과를 원하는데
위의 쿼리에서 조회된느값은
7 T
7 A로 나오네요 어덯게 해야될까요?
이런 식일까요?
with TMP_T as ( select 1 as no,'T' as nm from dual union all select 1 as no,'A' as nm from dual union all select 3 as no,'B' as nm from dual union all select 4 as no,'C' as nm from dual union all select 5 as no,'D' as nm from dual union all select 6 as no,'E' as nm from dual ) select (SELECT MAX(no) from TMP_T) + ROWNUM, NM from TMP_T where no = 1 order by no;