반응형
lag(컬럼명, 현재레코드에서 얼마나 건너띈 레코드인지 수 [,'null일 경우 들어가는 값'])
lead(컬럼명, 현재레코드에서 얼마나 건너띈 레코드인지 수 [,'null일 경우 들어가는 값'])
select idx,
subject,
lead(idx, 1, 0) over(order by idx) next_idx,
lead(subject, 1, '다음글') over(order by idx) next_title,
lag(idx, 1, 0) over(order by idx) pre_idx,
lag(subject, 1, '이전글') over(order by idx) pre_title
from board t
select * from (
select idx,
subject,
lead(idx, 1, 0) over(order by idx) next_idx,
lead(subject, 1, '다음글') over(order by idx) next_title,
lag(idx, 1, 0) over(order by idx) pre_idx,
lag(subject, 1, '이전글') over(order by idx) pre_title
from board t
)
where t.board_id=?
lead(컬럼명, 현재레코드에서 얼마나 건너띈 레코드인지 수 [,'null일 경우 들어가는 값'])
select idx,
subject,
lead(idx, 1, 0) over(order by idx) next_idx,
lead(subject, 1, '다음글') over(order by idx) next_title,
lag(idx, 1, 0) over(order by idx) pre_idx,
lag(subject, 1, '이전글') over(order by idx) pre_title
from board t
select * from (
select idx,
subject,
lead(idx, 1, 0) over(order by idx) next_idx,
lead(subject, 1, '다음글') over(order by idx) next_title,
lag(idx, 1, 0) over(order by idx) pre_idx,
lag(subject, 1, '이전글') over(order by idx) pre_title
from board t
)
where t.board_id=?
반응형
'Oracle(DB관련)' 카테고리의 다른 글
expdp, impdp, kill_jobs, dba_datapump_jobs (0) | 2011.09.30 |
---|---|
the Toad Extension for Eclipse (0) | 2010.10.07 |
오라클 암호화 (0) | 2010.04.22 |
숫자함수 (0) | 2009.11.04 |
문자함수 (0) | 2009.11.04 |