diff --git a/db/routines/vn/procedures/sale_replaceItem.sql b/db/routines/vn/procedures/sale_replaceItem.sql index 79997d989..51c6f6c08 100644 --- a/db/routines/vn/procedures/sale_replaceItem.sql +++ b/db/routines/vn/procedures/sale_replaceItem.sql @@ -78,7 +78,8 @@ BEGIN SELECT price INTO vNewPrice FROM tmp.ticketComponentPrice - WHERE (vQuantity % `grouping` = 0); + ORDER BY (vQuantity % `grouping`) ASC + LIMIT 1; IF vNewPrice IS NULL THEN CALL util.throw('price retrieval failed');