码迷,mamicode.com
首页 > 其他好文 > 详细

商标分发表

时间:2020-09-12 21:25:53      阅读:39      评论:0      收藏:0      [点我收藏+]

标签:item   sum   ati   set   lfs   join   mon   seo   itemid   

----引入函数
set  nocount  on

declare  @fbillno  varchar      

set    @fbillno=‘*FBILLNOCOMMON*‘

----引入内码表
select  finterid
into  #temp01
from   seorder
where  FCancellation=0   and   fbillno like  ‘%*FBILLNOCOMMON*%‘


----主程序

SELECT   a.fname  ,b.FName,b.FBillNo ,  SUM(a.FQty) AS FQty

FROM   (select  a.FInterID ,a.FBillNo,  c.fname  ,  b.FSourceInterId , b.FSourceEntryID ,b.fitemid  ,b.fqty
from  poorder  a
left join  POOrderEntry  b   on  b.FInterID=a.FInterID
left join  t_Supplier    c   on  c.fitemid=a.FSupplyID
where  b.FSourceInterId  in  (select  finterid
                              from  #temp01
                               ) ) a

left join   (select  b.FInterID  ,b.FEntryID  ,b.fitemid  ,c.fname, d.fbillno
from   seorderentry  b
left join SEOrder     d   on  d.FInterID=b.finterid
left join t_submessage  c   on  c.FInterID=b.FEntrySelfS0162
 )   b  on  b.finterid=a.FSourceInterId   and   b.FEntryID=a.FSourceEntryID
GROUP BY  a.fname   ,  b.FName,b.FBillNo
d

 

 


----结束
drop  table  #temp01

商标分发表

标签:item   sum   ati   set   lfs   join   mon   seo   itemid   

原文地址:https://www.cnblogs.com/qiugy/p/13589946.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!