Skip to content
Advertisement

Tag: datepart

DATEPART and DATEFIRST alternative for redshift

I’m trying to run in Redshift with the start day being Saturday. I tried using different syntax for SET DATEFIRST but it seems like it’s not supported (or I just can’t find the correct syntax for redshift). Are there any alternatives available? The documentation page only shows information for extracting a specific dow (day of week): https://docs.aws.amazon.com/redshift/latest/dg/r_DATE_PART_function.html Answer The date_trunc()

SELECT data grouped by WEEK in SQL

I have a working query (ORACLE SQL) that gives me gallons grouped by store number, with gallons summed by type and a percentage column as well. Each store number has a different conversion date from which I sum up the data – I now need to also sum it up by week, with Sunday being the first day of each

Advertisement