Created
October 12, 2018 14:25
-
-
Save raven-rock/692ac2347c108d94cef2b2335bfc40ba to your computer and use it in GitHub Desktop.
Redshift: derive week starting Sunday date from a date or timestamp value
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_col - (extract(dow from date_col) || ' day')::interval)::date as week_of_starting_sunday | |
from | |
mytable | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment