From: Ant Zucaro Date: Mon, 31 Dec 2012 03:41:11 +0000 (-0500) Subject: Add player retention query X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=202c53a8a920d8c972cfa439160d77822609186f;p=xonotic%2Fxonstatdb.git Add player retention query --- diff --git a/queries/player_retention_3months.sql b/queries/player_retention_3months.sql new file mode 100644 index 0000000..e19ff14 --- /dev/null +++ b/queries/player_retention_3months.sql @@ -0,0 +1,23 @@ +-- how many distinct player_ids play in multiple months +select count(*) +from players +where +player_id in ( + select distinct player_id + from player_game_stats + where create_dt between (current_timestamp at time zone 'UTC' - interval '1 month') + and (current_timestamp at time zone 'UTC') +) +and player_id in ( + select distinct player_id + from player_game_stats + where create_dt between (current_timestamp at time zone 'UTC' - interval '2 month') + and (current_timestamp at time zone 'UTC' - interval '1 month') +) +and player_id in ( + select distinct player_id + from player_game_stats + where create_dt between (current_timestamp at time zone 'UTC' - interval '3 month') + and (current_timestamp at time zone 'UTC' - interval '2 month') +) +; \ No newline at end of file