U8查询未完成订单
查询订单完成状况
use UFDATA_003_2018
select * from SO_SOMain inner join SO_SODetails on SO_SODetails.ID=SO_SOMain.ID where SO_SOMain.ID in(
select distinct SO_SOMain.ID from SO_SOMain inner join SO_SODetails on SO_SODetails.ID=SO_SOMain.ID where iQuantity>iFHQuantity and dDate>'2018-01-01'
)
该查询语句必须这样来处理,否则会破坏订单的完整性,有的订单可能有一部分完成,其他部分未完成,容易导致订单不完整
查询当月生产克重
select SUM(b.cFree3*b.iQuantity)/SUM(b.iQuantity) as 克重 from rdrecord10 as a
left join rdrecords10 as b on a.ID=b.ID
where a.dDate between '2019-01-26' and '2019-02-25'
查询供应商分类
select 'vd'+a.cVenCode as 供应商,a.cInvCode as 材料名称,inv.cInvName as 品名,vd.cVenName as 供应商 from(select rds.cInvCode,rd.cVenCode from RdRecord01 rd
left join RdRecords01 rds on rd.ID=rds.ID
group by rds.cInvCode,rd.cVenCode) as a
left join Vendor as vd on vd.cVenCode=a.cVenCode
left join Inventory as inv on inv.cInvCode=a.cInvCode