Fix incorrect query for selecting new clients by download source.

The old query was:
* Selecting data from 2 months ago instead of 1 month ago for some reason, presumably left over from when I was testing the query out for different time periods.
* Counting non-new players who used a new download source as new players.
This commit is contained in:
Pentarctagon 2023-04-14 22:32:48 -05:00
parent f6b6e1e0c8
commit 8e6df8cd1f
2 changed files with 7 additions and 5 deletions

View file

@ -5,6 +5,7 @@ from
from wesnothd_game_info game, wesnothd_game_player_info player from wesnothd_game_info game, wesnothd_game_player_info player
where game.INSTANCE_UUID = player.INSTANCE_UUID where game.INSTANCE_UUID = player.INSTANCE_UUID
and game.GAME_ID = player.GAME_ID and game.GAME_ID = player.GAME_ID
and player.CLIENT_SOURCE != ''
group by player.USER_ID group by player.USER_ID
) as temp ) as temp
where YEAR(FIRST_GAME_START) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH) where YEAR(FIRST_GAME_START) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)

View file

@ -1,13 +1,14 @@
select count(*) as NEW_USERS_FIRST_GAME, CLIENT_SOURCE select count(*) as NEW_USERS_FIRST_GAME, (select p2.CLIENT_SOURCE from wesnothd_game_player_info p2 where p2.USER_ID = temp.USER_ID limit 1) as CLIENT_SOURCE
from from
( (
select player.USER_ID, min(game.START_TIME) as FIRST_GAME_START, CLIENT_SOURCE select player.USER_ID, min(game.START_TIME) as FIRST_GAME_START
from wesnothd_game_info game, wesnothd_game_player_info player from wesnothd_game_info game, wesnothd_game_player_info player
where game.INSTANCE_UUID = player.INSTANCE_UUID where game.INSTANCE_UUID = player.INSTANCE_UUID
and game.GAME_ID = player.GAME_ID and game.GAME_ID = player.GAME_ID
and player.CLIENT_SOURCE != '' and player.CLIENT_SOURCE != ''
group by player.USER_ID, CLIENT_SOURCE group by player.USER_ID
) as temp ) as temp
where YEAR(FIRST_GAME_START) = YEAR(CURRENT_DATE - INTERVAL 2 MONTH) where YEAR(FIRST_GAME_START) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
and MONTH(FIRST_GAME_START) = MONTH(CURRENT_DATE - INTERVAL 2 MONTH) and MONTH(FIRST_GAME_START) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)
group by CLIENT_SOURCE group by CLIENT_SOURCE