日期:2019-08-16
-----重写馆藏表中的借阅总量和续借总量信息
create table jieyue as select h.barcode,count(*) sum from holding h ,log_cir l where h.barcode=l.data3 and l.logtype='30001' group by h.barcode;
create index idx_jieyue on jieyue(barcode);
update holding h set TOTALLOANNUM =(select sum from jieyue where barcode=h.barcode) where exists (select 1 from jieyue where barcode=h.barcode)
commit;
drop table jieyue;
-----更新续借总量
create table jieyue as select h.barcode,count(*) sum from holding h ,log_cir l where h.barcode=l.data3 and l.logtype in('30007','30009','30050','30415','30420') group by h.barcode;
create index idx_jieyue on jieyue(barcode);
update holding h set TOTALRENEWNUM =(select sum from jieyue where barcode=h.barcode) where exists (select 1 from jieyue where barcode=h.barcode)
commit;
drop table jieyue;