feat: refs #7564 Added volume column #2664

Merged
guillermo merged 11 commits from 7564-ticketVolume into dev 2024-08-30 11:57:10 +00:00
1 changed files with 4 additions and 4 deletions
Showing only changes of commit 8a03650eca - Show all commits

View File

@ -3,13 +3,13 @@ CREATE OR REPLACE TEMPORARY TABLE tTicketVolume
(PRIMARY KEY (id))
ENGINE = MEMORY
SELECT t.id, SUM(s.quantity * ic.cm3delivery / 1000000) volume
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
JOIN itemCost ic ON ic.itemFk = s.itemFk
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.itemCost ic ON ic.itemFk = s.itemFk
AND ic.warehouseFk = t.warehouseFk
GROUP BY t.id;
UPDATE ticket t
UPDATE vn.ticket t
JOIN tTicketVolume tv ON tv.id = t.id
SET t.volume = tv.volume;