Vigorously advanced inventory items, a solution of batch shipments.

zhaozj2021-02-16  130

Create Table G (Goods Varchar (2), Lot Varchar (3), BAL INT Create Table O (Oid Varchar, Goods Varchar (2), Qty Int) Insert G SELECT 'AA', 'P01', 5 Union Select ' AA ',' P02 ', 10 Union Select' BB ',' P01 ', 20

Insert o SELECT '1', 'AA', 11 Union Select '1', 'BB', 10 Union Select '2', 'AA', 2 Union Select '3', 'AA', 1

SELECT OID, B.GOODS, LOT, DELI = (Case When Sq> SB THEN SB ELSE SQ END) - (Case When SQ-QTY SB-Balorder by Oid, B.Goods, LOT

Drop Table G, O

转载请注明原文地址:https://www.9cbs.com/read-9034.html

New Post(0)