select
'',
'',
day1,
day2,
day3,
count(schoolno)-sum(value1) value1,
sum(value1) value2,
sum(extend_cnt) value3
from
(
select
to_char(d.usestart,'YYYY') day1,
to_char(d.usestart,'MM') day2,
to_char(d.usestart,'DD') day3,
d.schoolno schoolno,
to_char(usestart,'DD'),
to_char(regtime,'DD'),
decode(to_char(usestart,'DD'),to_char(regtime,'DD'),0,1) value1,
extend_cnt
from seatcode c, seatbookingview d
where d.usestart >= TO_DATE('2007090401','yyyymmddhh24')
and d.usestart < TO_DATE('2007090423','yyyymmddhh24')
and c.seatno = d.seatno
and d.sectorno = '111'
and ( d.status = 3 or d.status = 4 or d.status = 5 )
order by 1
)
group by day1, day2, day3
'',
'',
day1,
day2,
day3,
count(schoolno)-sum(value1) value1,
sum(value1) value2,
sum(extend_cnt) value3
from
(
select
to_char(d.usestart,'YYYY') day1,
to_char(d.usestart,'MM') day2,
to_char(d.usestart,'DD') day3,
d.schoolno schoolno,
to_char(usestart,'DD'),
to_char(regtime,'DD'),
decode(to_char(usestart,'DD'),to_char(regtime,'DD'),0,1) value1,
extend_cnt
from seatcode c, seatbookingview d
where d.usestart >= TO_DATE('2007090401','yyyymmddhh24')
and d.usestart < TO_DATE('2007090423','yyyymmddhh24')
and c.seatno = d.seatno
and d.sectorno = '111'
and ( d.status = 3 or d.status = 4 or d.status = 5 )
order by 1
)
group by day1, day2, day3
'database > oracle' 카테고리의 다른 글
tablespace, user delete (0) | 2012.03.22 |
---|---|
Data Import (0) | 2012.03.22 |
Oracle XDB 의 8080 port 바꾸는 방법 (0) | 2012.03.22 |
오라클 데이터 Export (0) | 2012.03.22 |
오라클 설치 후 삭제 (0) | 2012.03.22 |