Created
April 21, 2016 09:03
-
-
Save Kimserey/1470cb0e51d91fede084ea0ecae104e9 to your computer and use it in GitHub Desktop.
Events per day
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