diff --git a/db/routines/vn/procedures/item_getBalance.sql b/db/routines/vn/procedures/item_getBalance.sql index 11af7e570..88583cf00 100644 --- a/db/routines/vn/procedures/item_getBalance.sql +++ b/db/routines/vn/procedures/item_getBalance.sql @@ -179,7 +179,7 @@ BEGIN LEFT JOIN alertLevel a ON a.id = t.alertLevel; ELSE - SELECT SUM(`in`) - SUM(`out`) INTO @a + SELECT IFNULL(SUM(IFNULL(`in`, 0)) - SUM(IFNULL(`out`, 0)), 0) INTO @a FROM tItemDiary WHERE shipped < vDate;