insert into TBL_TOTAL_R(CODE,salary,TM,YR,MNTH,DAY)
(
select CODE,sum(DRP) salary,To_date('2011-07-10','yyyy-mm-dd hh24-mi-ss') TM ,
substr('2011-07-10',0,4) YR,
substr('2011-07-10',6,2) MNTH,
substr('2011-07-10',9,2) DAY
from TBL_SALARY_R
where TM>To_date('2011-07-10','yyyy-mm-dd hh24-mi-ss')
and To_date('2011-08-10','yyyy-mm-dd hh24-mi-ss')>=TM
group by STCD, To_date('2011-07-10','yyyy-mm-dd hh24-mi-ss')
(
select CODE,sum(DRP) salary,To_date('2011-07-10','yyyy-mm-dd hh24-mi-ss') TM ,
substr('2011-07-10',0,4) YR,
substr('2011-07-10',6,2) MNTH,
substr('2011-07-10',9,2) DAY
from TBL_SALARY_R
where TM>To_date('2011-07-10','yyyy-mm-dd hh24-mi-ss')
and To_date('2011-08-10','yyyy-mm-dd hh24-mi-ss')>=TM
group by STCD, To_date('2011-07-10','yyyy-mm-dd hh24-mi-ss')
)
将查询的信息, 插入到另一张表中