日期:2019-08-16
---备份通借通还记录
select from loan_work l where exists(select from reader where rdlib='' and l.rdid=rdid) and not exists(select * from holding where orglib='' and l.barcode=barcode);---查询本馆读者借外馆图书
create table loan_work_reader select from loan_work l where exists(select from reader where rdlib='' and l.rdid=rdid) and not exists(select * from holding where orglib='' and l.barcode=barcode);
select from loan_work l where not exists(select from reader where rdlib='' and l.rdid=rdid) and exists(select * from holding where orglib='' and l.barcode=barcode);---查询外馆读者借本馆图书
create table loan_work_holding select from loan_work l where not exists(select from reader where rdlib='' and l.rdid=rdid) and exists(select * from holding where orglib='' and l.barcode=barcode);
delete from loan_work l where not exists (select from reader where l.rdid=rdid and rdlib='') and not exists (select from holding where l.barcode=barcode and orglib='');
; ---删除不属于本馆书和读者的流通记录
delete from reader where rdlib<>''; --删除不属于本馆的读者
delete from log_cir where libcode<>'';---删除不属于本馆的流通日志 (执行时间比较久)
delete from ser_bind where libcode<>'' --删除不属于本馆的期刊装订
delete from ser_vol where libcode<>''
delete from ser_check where libcode<>''
delete from ser_order where libcode<>''
delete from holding where orglib<>'';