From 4aee175105d20838ef0a382deca21ed67db55994 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Mon, 12 Jul 2021 18:58:49 +0200 Subject: [PATCH] Keep the newest instead of the oldest on campacting stock entries --- migrations/0143.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migrations/0143.sql b/migrations/0143.sql index 32631f50..c0ff45af 100644 --- a/migrations/0143.sql +++ b/migrations/0143.sql @@ -9,7 +9,7 @@ SELECT product_id, SUM(amount) AS total_amount, MIN(stock_id) AS stock_id_to_keep, - MIN(id) AS id_to_keep, + MAX(id) AS id_to_keep, GROUP_CONCAT(id) AS id_group, GROUP_CONCAT(stock_id) AS stock_id_group, id -- Dummy