From 04d3d13e822acc7fb88f44bd59bf113008d578a7 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 3 Jan 2023 10:36:31 +0100 Subject: [PATCH] refs #5051 sub stmt --- back/methods/campaign/latest.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/back/methods/campaign/latest.js b/back/methods/campaign/latest.js index a05a18eca..7a4778033 100644 --- a/back/methods/campaign/latest.js +++ b/back/methods/campaign/latest.js @@ -29,10 +29,11 @@ module.exports = Self => { filter = mergeFilters(filter, {where}); const stmt = new ParameterizedSQL( - `SELECT * FROM campaign`); + `SELECT * FROM (`); + stmt.merge('SELECT * FROM campaign'); stmt.merge(conn.makeWhere(filter.where)); + stmt.merge('ORDER BY dated ASC) sub'); stmt.merge('GROUP BY code'); - stmt.merge('ORDER BY dated ASC'); stmt.merge('LIMIT 10000000000000000000'); stmt.merge(conn.makePagination(filter));