Home > database >  Consult a MySQL stored procedures more table updates - MSSQL turned over next door.
Consult a MySQL stored procedures more table updates - MSSQL turned over next door.

Time:10-01

 
CREATE PROCEDURE UpdateSalesToResult (IN SalesDate varchar)
The BEGIN

The UPDATE list_result t
INNER JOIN sales s
ON t.d ate_=s.d. ate_ and t.s torecode=s.s torecode and t.i temcode=s.i temcode
The SET t.S tockQty=s.y stock, t.S alesQty=s.y sales
WHERE s.d. ate_=SalesDate

END;


(Err), 1064 - You have an error in your SQL syntax; Check the manual that corresponds to your MySQL server version for the right syntax to use near ')
The BEGIN
The UPDATE list_result t
INNER JOIN sales s
ON t.d ate_=s.d. ate_ an 'at line 1
My goal is to pass in a date, then the two data updates to the result of the SALES list,

CodePudding user response:

The UPDATE list_result t, sales s
The SET t.S tockQty=s.y stock, t.S alesQty=s.y sales
WHERE s.d. ate_=SalesDate and t.d ate_=s.d. ate_ and t.s torecode=s.s torecode and t.i temcode=s.i temcode

CodePudding user response:

 
CREATE PROCEDURE UpdateSalesToResult (IN SalesDate varchar)
The BEGIN

The UPDATE list_result t
INNER JOIN sales s
ON t.d ate_=s.d. ate_ and t.s torecode=s.s torecode and t.i temcode=s.i temcode
The SET t.S tockQty=s.y stock, t.S alesQty=s.y sales
WHERE s.d. ate_=SalesDate

END;


Become
 
CREATE PROCEDURE UpdateSalesToResult (IN SalesDate varchar)
The BEGIN

The UPDATE list_result t
INNER JOIN sales s
ON t.d ate_=s.d. ate_ and t.s torecode=s.s torecode and t.i temcode=s.i temcode
The SET t.S tockQty=s.y stock, t.S alesQty=s.y sales
WHERE s.d. ate_=SalesDate;

END


It is good!
  • Related