feat: refs #7377 Delete items
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
fc0c03f01a
commit
ae999f780e
|
@ -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.id 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
|
||||||
|
|
Loading…
Reference in New Issue