-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Time: 5680 ms (5.01%), Space: 0B (100.00%) - LeetHub
- Loading branch information
1 parent
f09a0bd
commit 8b9cebd
Showing
1 changed file
with
0 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,2 @@ | ||
# Write your MySQL query statement below | ||
#SELECT * FROM (SELECT player_id, event_date FROM Activity ORDER BY event_date DESC) a GROUP BY player_id; | ||
|
||
#SELECT player_id, event_date FROM Activity ORDER BY event_date DESC | ||
|
||
#SELECT DISTINCT(player_id) FROM Activity; | ||
|
||
#SELECT player_id, FROM Activity GROUP BY player_id; | ||
|
||
SELECT ROUND((COUNT(*)/(SELECT COUNT(DISTINCT(player_id)) FROM Activity)),2) AS fraction FROM (SELECT player_id, MIN(event_date) AS first_log, (SELECT MIN(event_date) FROM Activity WHERE player_id = a1.player_id AND event_date > (SELECT MIN(event_date) FROM Activity WHERE player_id = a1.player_id)) AS second_log FROM Activity a1 GROUP BY player_id) logs WHERE DATEDIFF(second_log, first_log) = 1; |