From 0851c6fb97fde7b96850f0335b514778a51516b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s?= Date: Thu, 26 Sep 2024 12:48:18 +0200 Subject: [PATCH] fix: refs #7779 refactor collection --- db/routines/vn/procedures/collection_new.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/collection_new.sql b/db/routines/vn/procedures/collection_new.sql index facf554a0..1f85aeebe 100644 --- a/db/routines/vn/procedures/collection_new.sql +++ b/db/routines/vn/procedures/collection_new.sql @@ -245,7 +245,7 @@ BEGIN SELECT wagon INTO vFreeWagonFk FROM tTrain GROUP BY wagon - HAVING SUM(IFNULL(ticketFk, 0)) = 0 + HAVING COUNT(ticketFk) = 0 ORDER BY wagon LIMIT 1; @@ -262,7 +262,7 @@ BEGIN JOIN (SELECT wagon FROM tTrain GROUP BY wagon - HAVING SUM(IFNULL(ticketFk, 0)) = 0 + HAVING COUNT(ticketFk) = 0 ) sub ON sub.wagon = tt.wagon; END IF; END IF;