From 4b24cf1cddc8611f4ee6c96eceb8f43212ec7327 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+AuroraLS3@users.noreply.github.com> Date: Sat, 18 Sep 2021 21:16:23 +0300 Subject: [PATCH] Order by different date in start date query Affects issues: - Possibly fixed #2080 --- .../plan/storage/database/queries/objects/TPSQueries.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/TPSQueries.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/TPSQueries.java index 5f88e0e14..fc4c909e1 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/TPSQueries.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/objects/TPSQueries.java @@ -478,13 +478,13 @@ public class TPSQueries { DATE + " AS d1" + FROM + TABLE_NAME + WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID + - ORDER_BY + DATE + " DESC"; + ORDER_BY + "d1 DESC"; String selectRowNumber = SELECT + "ROW_NUMBER() over (ORDER BY " + DATE + ") AS rn, " + DATE + " AS previous_date" + FROM + TABLE_NAME + WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID + - ORDER_BY + DATE + " DESC"; + ORDER_BY + "previous_date DESC"; String selectFirstEntryDate = SELECT + "MIN(" + DATE + ") as start_time" + FROM + TABLE_NAME + WHERE + SERVER_ID + '=' + ServerTable.STATEMENT_SELECT_SERVER_ID;