mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-05 15:02:26 +01:00
Fixed networkGeolocationCounts for multiple users
This commit is contained in:
parent
26cd95cab8
commit
fe29f44680
@ -183,19 +183,16 @@ public class ServerAggregateQueries {
|
|||||||
|
|
||||||
public static Query<Map<String, Integer>> networkGeolocationCounts() {
|
public static Query<Map<String, Integer>> networkGeolocationCounts() {
|
||||||
String subQuery1 = "SELECT " +
|
String subQuery1 = "SELECT " +
|
||||||
GeoInfoTable.ID + ", " +
|
|
||||||
GeoInfoTable.GEOLOCATION + ", " +
|
GeoInfoTable.GEOLOCATION + ", " +
|
||||||
GeoInfoTable.LAST_USED + ", " +
|
GeoInfoTable.LAST_USED +
|
||||||
" FROM " + GeoInfoTable.TABLE_NAME;
|
" FROM " + GeoInfoTable.TABLE_NAME;
|
||||||
String subQuery2 = "SELECT " +
|
String subQuery2 = "SELECT " +
|
||||||
GeoInfoTable.ID + ", " +
|
|
||||||
"MAX(" + GeoInfoTable.LAST_USED + ") as m" +
|
"MAX(" + GeoInfoTable.LAST_USED + ") as m" +
|
||||||
" FROM " + GeoInfoTable.TABLE_NAME +
|
" FROM " + GeoInfoTable.TABLE_NAME +
|
||||||
" GROUP BY " + GeoInfoTable.USER_UUID;
|
" GROUP BY " + GeoInfoTable.USER_UUID;
|
||||||
String sql = "SELECT " + GeoInfoTable.GEOLOCATION + ", COUNT(1) as c FROM (" +
|
String sql = "SELECT " + GeoInfoTable.GEOLOCATION + ", COUNT(1) as c FROM (" +
|
||||||
"(" + subQuery1 + ") AS q1" +
|
"(" + subQuery1 + ") AS q1" +
|
||||||
" INNER JOIN (" + subQuery2 + ") AS q2 ON q1.id = q2.id)" +
|
" INNER JOIN (" + subQuery2 + ") AS q2 ON q1.last_used = q2.m)" +
|
||||||
" WHERE " + GeoInfoTable.LAST_USED + " = m" +
|
|
||||||
" GROUP BY " + GeoInfoTable.GEOLOCATION;
|
" GROUP BY " + GeoInfoTable.GEOLOCATION;
|
||||||
|
|
||||||
return new QueryAllStatement<Map<String, Integer>>(sql) {
|
return new QueryAllStatement<Map<String, Integer>>(sql) {
|
||||||
|
Loading…
Reference in New Issue
Block a user