]> de.git.xonotic.org Git - xonotic/xonstatdb.git/commitdiff
Add player retention query
authorAnt Zucaro <azucaro@gmail.com>
Mon, 31 Dec 2012 03:41:11 +0000 (22:41 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Mon, 31 Dec 2012 03:41:11 +0000 (22:41 -0500)
queries/player_retention_3months.sql [new file with mode: 0644]

diff --git a/queries/player_retention_3months.sql b/queries/player_retention_3months.sql
new file mode 100644 (file)
index 0000000..e19ff14
--- /dev/null
@@ -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