Created
March 11, 2016 11:45
-
-
Save Kimserey/b28923e75ce3d245d0e8 to your computer and use it in GitHub Desktop.
Sqlite gist
This file contains hidden or 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
/* events per day */ | |
SELECT | |
DATE(timestamp / 10000000 - 62135596800, 'unixepoch') AS date, | |
(CASE | |
WHEN strftime('%w', DATE(timestamp / 10000000 - 62135596800, 'unixepoch')) == '0' THEN 'Sunday' | |
WHEN strftime('%w', DATE(timestamp / 10000000 - 62135596800, 'unixepoch')) == '1' THEN 'Monday' | |
WHEN strftime('%w', DATE(timestamp / 10000000 - 62135596800, 'unixepoch')) == '2' THEN 'Tuesday' | |
WHEN strftime('%w', DATE(timestamp / 10000000 - 62135596800, 'unixepoch')) == '3' THEN 'Wednesday' | |
WHEN strftime('%w', DATE(timestamp / 10000000 - 62135596800, 'unixepoch')) == '4' THEN 'Thursday' | |
WHEN strftime('%w', DATE(timestamp / 10000000 - 62135596800, 'unixepoch')) == '5' THEN 'Friday' | |
WHEN strftime('%w', DATE(timestamp / 10000000 - 62135596800, 'unixepoch')) == '6' THEN 'Saturday' | |
END) as 'day of the week', | |
count(*) AS 'count of events' | |
FROM events | |
GROUP BY date | |
ORDER BY date DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment