Compare commits

...

2 Commits

Author SHA1 Message Date
Guillermo Bonet 16ba74dffc feat: refs #7377 Minor change
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-06-21 09:14:13 +02:00
Guillermo Bonet ae999f780e feat: refs #7377 Delete items
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-06-21 09:12:32 +02:00
1 changed files with 9 additions and 0 deletions

View File

@ -220,6 +220,15 @@ BEGIN
vEntryFk vEntryFk
FROM tInventory; FROM tInventory;
-- Eliminamos artículos que no estén en el inventario sin compra o venta
DELETE i.* FROM item i
LEFT JOIN tInventory ti ON ti.itemFk = i.id
LEFT JOIN sale s ON s.itemFk = i.id
LEFT JOIN buy b ON b.itemFk = i.id
WHERE ti.itemFk IS NULL
AND s.id IS NULL
AND b.id IS NULL;
-- Update the 'lastUsed' field of the item -- Update the 'lastUsed' field of the item
UPDATE item i UPDATE item i
JOIN tInventory i2 ON i2.itemFk = i.id JOIN tInventory i2 ON i2.itemFk = i.id