—某个书商下验收过的所有图书详情,包含无订单的数据
    select distinct c.marc_rec_no marc记录号,d.m_title 题名,d.m_isbn ISBN,d.m_author 著者,d.m_publisher 出版社,d.m_pub_year 出版年,c.price 价格,
    a.chk_set_qty 验收套数,c.call_no 索书号,a.chk_batch_no 验收批次
    from order_check a,check_acct b,indi_acct c,marc d,publish_busi e
    where a.chk_batch_no=b.chk_batch_no and a.marc_rec_no=d.marc_rec_no and c.marc_rec_no=d.marc_rec_no
    and b.publ_code=e.publ_code and e.publ_name=’某个书商名’ order by a.chk_batch_no;

    —某个书商有订单记录入藏的图书详情
    select distinct c.marc_rec_no marc记录号,d.m_title 题名,d.m_isbn ISBN,d.m_author 著者,d.m_publisher 出版社,d.m_pub_year 出版年,c.price 价格,
    a.chk_set_qty 验收套数,c.call_no 索书号,a.chk_batch_no 验收批次,b.asord_cata_no 订购目录
    from order_check a,order_record b,indi_acct c,marc d,publish_busi e where a.asord_no=b.asord_no
    and a.marc_rec_no=d.marc_rec_no and c.marc_rec_no=d.marc_rec_no and b.publ_code=e.publ_code and e.publ_name=’某个书商名’ order by a.chk_batch_no;

    —采购老师工号,书商分组统计订购和到书情况以及比例
    select aa.resp_wkr 工号,c.publ_name 出版社,aa.num1 订购种数,bb.num2 到馆种数,round(bb.num2/aa.num1,4) 比例
    from (select a.resp_wkr,a.publ_code,count(distinct a.marc_rec_no) num1 from order_record a
    where a.ord_date >=’2018-01-01’ and a.ord_date <= ‘2018-06-30’group by a.resp_wkr,a.publ_code) aa,
    (select b.resp_wkr,b.publ_code,count(distinct a.marc_rec_no) num2 from indi_acct a,order_record b,marc c
    where a.marc_rec_no=c.marc_rec_no and b.marc_rec_no=c.marc_rec_no
    and b.ord_date >=’2018-01-01’ and b.ord_date <= ‘2018-06-30’ group by b.resp_wkr,b.publ_code) bb,publish_busi c
    where aa.resp_wkr=bb.resp_wkr and aa.publ_code=bb.publ_code and aa.publ_code=c.publ_code order by aa.resp_wkr,c.publ_name;

    —限定征订导入时间,查询书商征订目录里征订分类情况
    select d.publ_name 书商,a.asord_cata_no 征订目录,count(case when c.m_call_no like ‘A%’ then 1
    else null end )A类种数,count(case when c.m_call_no like ‘B%’ then 1
    else null end )B类种数,count(case when c.m_call_no like ‘C%’ then 1
    else null end )C类种数,count(case when c.m_call_no like ‘D%’ then 1
    else null end )D类种数,count(case when c.m_call_no like ‘E%’ then 1
    else null end )E类种数,count(case when c.m_call_no like ‘F%’ then 1
    else null end )F类种数,count(case when c.m_call_no like ‘G%’ then 1
    else null end )G类种数,count(case when c.m_call_no like ‘H%’ then 1
    else null end )H类种数,count(case when c.m_call_no like ‘I%’ then 1
    else null end )I类种数,count(case when c.m_call_no like ‘J%’ then 1
    else null end )J类种数,count(case when c.m_call_no like ‘K%’ then 1
    else null end )K类种数,count(case when c.m_call_no like ‘N%’ then 1
    else null end )N类种数,count(case when c.m_call_no like ‘O%’ then 1
    else null end )O类种数,count(case when c.m_call_no like ‘P%’ then 1
    else null end )P类种数,count(case when c.m_call_no like ‘Q%’ then 1
    else null end )Q类种数,count(case when c.m_call_no like ‘R%’ then 1
    else null end )R类种数,count(case when c.m_call_no like ‘S%’ then 1
    else null end )S类种数,count(case when c.m_call_no like ‘T%’ then 1
    else null end )T类种数,count(case when c.m_call_no like ‘U%’ then 1
    else null end )U类种数,count(case when c.m_call_no like ‘V%’ then 1
    else null end )V类种数,count(case when c.m_call_no like ‘X%’ then 1
    else null end )X类种数,count(case when c.m_call_no like ‘Z%’ then 1
    else null end )Z类种数 from asord_cata a,asord_cata_detl b,asord_marc c,publish_busi d
    where a.asord_cata_no=b.asord_cata_no and b.asord_marc_rec_no=c.asord_marc_rec_no and a.publ_code=d.publ_code
    and a.asord_date>=’2018-01-01’ and a.asord_date<=’2018-12-31’
    group by d.publ_name,a.asord_cata_no
    order by d.publ_name;

    —限定征订导入时间,查询书商征订目录里按出版社征订情况
    select d.publ_name 书商,c.m_publisher 出版社,count(c.asord_marc_rec_no) 征订种数
    from asord_cata a,asord_cata_detl b,asord_marc c,publish_busi d
    where a.asord_cata_no=b.asord_cata_no and b.asord_marc_rec_no=c.asord_marc_rec_no and a.publ_code=d.publ_code
    and a.asord_date>=’2018-01-01’ and a.asord_date<=’2018-12-31’
    group by d.publ_name,c.m_publisher
    order by d.publ_name,征订种数 desc;

    —订购统计:“书商“”在“某一段时间”(或某年)内提供“某一出版社”的图书种数、册数
    select c.publ_name 书商,a.m_publisher 出版社,count(b.marc_rec_no) 种数,sum(b.order_set_qty) 订购套数
    from marc a,order_record b,publish_busi c
    where a.marc_rec_no=b.marc_rec_no and b.publ_code=c.publ_code
    and substr(b.ord_date,1,10) between ‘2018-01-01’ and ‘2018-12-31’
    group by c.publ_name,a.m_publisher
    order by c.publ_name,种数 desc;