Last active
January 17, 2022 08:29
-
-
Save Mr--John-Doe/13edd6924c2532ee13ce483911a994a8 to your computer and use it in GitHub Desktop.
WindowFunctions-QueryB-WithRoundingIssues
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
SELECT day AS day_of_week | |
, COUNT(*) AS dow_accidents | |
, SUM(dow_accidents) OVER (PARTITION BY 0) AS total_accidents | |
, ROUND(dow_accidents / total_accidents, 4) AS dow_accidents_percent | |
FROM temp.CAMBRIDGESHIRE_ACCIDENTS | |
WHERE accident_ts BETWEEN '2017-01-01'::date AND '2017-01-31'::date | |
GROUP BY 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment