refactor: refs #7486 engine memory and primary key sales_merge
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
75a529830c
commit
bd13ecd464
|
@ -8,6 +8,8 @@ BEGIN
|
||||||
END;
|
END;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tSalesToPreserve
|
CREATE OR REPLACE TEMPORARY TABLE tSalesToPreserve
|
||||||
|
(PRIMARY KEY (id))
|
||||||
|
ENGINE = MEMORY
|
||||||
SELECT s.id, s.itemFk, SUM(s.quantity) newQuantity
|
SELECT s.id, s.itemFk, SUM(s.quantity) newQuantity
|
||||||
FROM sale s
|
FROM sale s
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
|
@ -20,7 +22,7 @@ BEGIN
|
||||||
|
|
||||||
UPDATE sale s
|
UPDATE sale s
|
||||||
JOIN tSalesToPreserve stp ON stp.id = s.id
|
JOIN tSalesToPreserve stp ON stp.id = s.id
|
||||||
SET quantity = newQuantity
|
SET s.quantity = newQuantity
|
||||||
WHERE s.ticketFk = vTicketFk;
|
WHERE s.ticketFk = vTicketFk;
|
||||||
|
|
||||||
DELETE s.*
|
DELETE s.*
|
||||||
|
|
Loading…
Reference in New Issue