diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/access/queries/ServerAggregateQueries.java b/Plan/common/src/main/java/com/djrapitops/plan/db/access/queries/ServerAggregateQueries.java index ec5f55a9d..55bb30c3d 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/access/queries/ServerAggregateQueries.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/access/queries/ServerAggregateQueries.java @@ -183,19 +183,16 @@ public class ServerAggregateQueries { public static Query> networkGeolocationCounts() { String subQuery1 = "SELECT " + - GeoInfoTable.ID + ", " + GeoInfoTable.GEOLOCATION + ", " + - GeoInfoTable.LAST_USED + ", " + + GeoInfoTable.LAST_USED + " FROM " + GeoInfoTable.TABLE_NAME; String subQuery2 = "SELECT " + - GeoInfoTable.ID + ", " + "MAX(" + GeoInfoTable.LAST_USED + ") as m" + " FROM " + GeoInfoTable.TABLE_NAME + " GROUP BY " + GeoInfoTable.USER_UUID; String sql = "SELECT " + GeoInfoTable.GEOLOCATION + ", COUNT(1) as c FROM (" + "(" + subQuery1 + ") AS q1" + - " INNER JOIN (" + subQuery2 + ") AS q2 ON q1.id = q2.id)" + - " WHERE " + GeoInfoTable.LAST_USED + " = m" + + " INNER JOIN (" + subQuery2 + ") AS q2 ON q1.last_used = q2.m)" + " GROUP BY " + GeoInfoTable.GEOLOCATION; return new QueryAllStatement>(sql) {