728x90
반응형
그 이전상태의 값을 가져오더라..
select
resident_no, user_id,status_g, reg_dt,
lag(status_g,1) over (partition by resident_no order by reg_dt) as status_g_prev,
lag(reg_dt,1) over (partition by resident_no order by reg_dt) as reg_dt_prev,
lag(user_id,1) over (partition by resident_no order by reg_dt) as uesr_id_prev
from crss_status_his
728x90
반응형
'SQL > ORACLE' 카테고리의 다른 글
[Oracle]시퀀스(Sequence) 만들기 (0) | 2014.02.12 |
---|---|
[Oracle]딕셔너리를 이용한 Constraint 이름 확인하기 (0) | 2014.02.12 |
[Oracle]Constraint 사용방법 (0) | 2014.02.12 |
[Oracle]테이블 만들때 Constraint 추가하기 (0) | 2014.02.12 |
[ORACLE] LEAST함수를 이용한 SQL문 (0) | 2014.02.12 |
[ORACLE]COUNT(DECODE.....)를 이용한 SQL문 (0) | 2014.02.12 |
[ORACLE]해당월의 마지막 일 가져오기 LAST_DAY (0) | 2014.02.12 |
[ORACLE]프로시저 컴파일하는 방법 (0) | 2014.02.12 |