Home > database >  Daniel SQL trigger problem solving
Daniel SQL trigger problem solving

Time:12-27

Table A
FInterID Fcancellation FMrpCLosed
Table B
FInterID fqty fstockqty
Table C
FItemID C_QTY

A, B value calculation is worth pfqty LianZha
The select b. ItemID, sum (b. qty - b. stockqty) as pfqty
The FROM POOrderEntry b
INNER JOIN POOrder a ON a.F InterID=b. InterID
Where a.F cancellation=0 and b. MrpCLosed=0
GROUP BY b. ItemID

A, B value calculation after LianZha incoming C_QTY, trigger how to write?

CodePudding user response:

Table C and how you found out the result set of the connection, what do you need when the trigger, if it is the result of the select to import to table C, that you have done homework regularly,

CodePudding user response:

There's no need for the table C,
It is ok to write a view:
 
- create viewThe CREATE VIEW view_A_B
AS
The select b. ItemID, sum (b. qty - b. stockqty) as pfqty
The FROM POOrderEntry b
INNER JOIN POOrder a ON a.F InterID=b. InterID
Where a.F cancellation=0 and b. MrpCLosed=0
GROUP BY b. ItemID
GO


- query:
SELECT * FROM view_A_B
  • Related