Last active
January 14, 2022 17:58
-
-
Save Mr--John-Doe/fb0aca8d1182760363e2c14f33f9d198 to your computer and use it in GitHub Desktop.
WindowFunctions-QueryA-WithWindowFunc
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 DATE AS DATE | |
, police_ref AS police_ref | |
, casualties AS casualties | |
, SUM(casualties) OVER (PARTITION BY DATE) AS day_total_casualties | |
, casualties / day_total_casualties AS casualties_percent_of_day --using lateral alias: day_total_casualties | |
FROM temp.CAMBRIDGESHIRE_ACCIDENTS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment