Home > database > How to add to the inventory receipt in the ERP system data in the table
How to add to the inventory receipt in the ERP system data in the table
Time:10-13
GRN # 11, 12 data (identical) auxiliary information in addition to table C into a column, and according to the balance to calculate the inventory of the previous period, how to write SQL! Novice,,, please the great god write clear point
CodePudding user response:
Didn't understand what you mean
CodePudding user response:
Color, product name, SELECT a. a. a. batch number, ISNULL (which OTAL, 0) AS into, a. inventory of the previous period, a. the previous inventory - ISNULL (which OTAL, 0) AS the balance The FROM C LEFT the JOIN (SELECT the product name, color, batch number, SUM (CASE WHEN return=1 THEN number 1 * ELSE material quantity END) AS the TOTAL JOIN the FROM B ON b. a. receipt number=a. receipt number WHERE storage time BETWEEN '2019-10-11' AND '2019-10-13 s' AND the examination AND approval=1 GROUP BY product name, color, batch number) AS D ON a. product name=C. The product name AND a. color=c. color AND a. batch number=c. batch number
CodePudding user response:
I understand it is a little bit, Seems to be a month to do the balance report,
The beginning balance
CodePudding user response:
1. Design a inventory list separately, later will be more convenient 2. Use a stored procedure, at the time of receipt to review, at the same time the data is inserted into the inventory table,
CodePudding user response:
Correct once, is a dynamic balance statements,
This issue still occurs The final balance
According to the payment days query deadline as the basis of the balance summary,
CodePudding user response:
C table is inventory list, how to write an update statement? Or as a stored procedure, how to write