select a.sum1-b.sum2 from (select sum(num) sum1 from tbl_200504 where time<=to_date('200504','yyyymm)) a, (select sum(num) sum2 from tbl_200505 where time<to_date('200505','yyyymm)) b;
select (select max(time) from tbl_200505) as thismonth, sum(a.num)-sum(b.num) from tbl_200505 a,tbl_200504 b where a.time<=(select max(time) from tbl_200505) and b.time <(select max(time) from tbl_200505)
(select sum(num) sum1 from tbl_200504 where time<=to_date('200504','yyyymm)) a,
(select sum(num) sum2 from tbl_200505 where time<to_date('200505','yyyymm)) b;
sum(a.num)-sum(b.num) from tbl_200505 a,tbl_200504 b
where a.time<=(select max(time) from tbl_200505)
and b.time <(select max(time) from tbl_200505)