select nvl(sum(decode(mrkt,'N',1,0)),0),
nvl(sum(decode(mrkt,'N',0,'H',0,1)),0),
nvl(sum(decode(mrkt,'H',1,0)),0),
nvl(sum(anum + cnum),0)
into n_compcnt,n_occcnt,n_housecnt,n_guestcnt
from fo_in_res where arrival <= to_date(v_date) and depart > to_date(v_date);
nvl(sum(decode(mrkt,'N',0,'H',0,1)),0),
nvl(sum(decode(mrkt,'H',1,0)),0),
nvl(sum(anum + cnum),0)
into n_compcnt,n_occcnt,n_housecnt,n_guestcnt
from fo_in_res where arrival <= to_date(v_date) and depart > to_date(v_date);
'IT > DB' 카테고리의 다른 글
[Oracle SQL] 1컬럼 2컬럼의 값을 그대로 입력할경우 (0) | 2015.07.27 |
---|---|
[Oracle SQL] international age 계산하는 SQL (0) | 2015.07.27 |
[Oracle] 검색 조건 '%' (0) | 2015.07.27 |
[Oracle SQL] 테이블 정의서 query (0) | 2015.07.27 |
[Oracle] DECODE 함수 (0) | 2015.07.27 |