Batch Dynamic PIN inquiry to logistics

Source: Internet
Author: User

Batch Dynamic PIN inquiry to logistics

Select a.spid,a.pici,sum (SHL)  shl into  #1  from  (select a.djbh,a.spid,a.pici ,-a.shl as shl from pf_ckmx a,pf_ckhz b where a.djbh=b.djbh and  a.djbh like  ' xs[a,c]% '  and a.rq>= ' 2016-04-20 '  and b.dwbh not  in  (select dwbh from mchk where dwmch= ' Shanxi Zhendong Pharmaceutical Logistics Co., Ltd. '  and isxs= ' is ') Union allselect a.djbh,a.spid,a.pici,a.shl from jh_rkmx a,jh_rkhz b where  a.djbh=b.djbh and a.rq>= ' 2016-04-20 '  and a.djbh like  ' jh[a,c]% ')   Agroup by a.spid,a.piciselect spid,pici,sum (SHL)  shl into  #2  from  ( Select spid, Batch  pici, quantity &NBSP;SHL&NBSP;FROM&NBSP;FR_SPKFK160421UNION&NBSP;ALLSELECT&NBSP;SPID,PICI,SHL  from  #1)  agroup by spid,piciselect a.*,b.chbdj*a.shl chbje,c.bmgsinto   #3  from  #2  ajoin spkfjc b on a.spid=b.spidleft join  (Select distinct bmgs, Pici from sphwph where bmgs<> ')  c on a.pici=c.piciselect b.bmgs ,f.ywlxr,a.spbh,a.spmch,a.shpgg,a.dw,a.jlgg,a.shengccj,f.pihao,f.baozhiqi,f.sxrq,c.rq as  Purchase date, c.rkshl,c.rkshl-b.shl as  Sales, B.shl,b.chbje,d.danwbh,d.dwmch,ltrim (RTrim (b.pici))  as  picifrom  #3  bjoin spkfk a on a.spid=b.spidjoin splsk c on  C.djbh=left (b.pici,14)  and c.dj_sn=replace (B.pici,left (b.pici,15), ') Join mchk d on  c.dwbh=d.dwbhleft join  (Select distinct pici,ywlxr,pihao,sxrq,baozhiqi from  sphwph where ywlxr<> ")  f on b.pici=f.piciwhere b.shl>0


Batch Dynamic PIN inquiry to logistics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.