Sample Header Ad - 728x90

AWS Athena: syntax for grouping data for week ending on a Saturday

1 vote
1 answer
2621 views
I'm having some issues with the Presto syntax in grouping data by separate weeks, ending on Saturdays. I have this field called "timestamp," and I've been using the the following to group by weeks. However, I noticed that date_truncs weeks ending on a Monday and using a date_add doesn't necessary group all rows correctly. select date_add('day', 5, date_trunc('week', date(substr(timestamp, 1, 10)))) as week_ending Any suggestions on how I can group weeks ending on Saturdays? Thanks!
Asked by Jamal (11 rep)
Aug 27, 2019, 06:17 AM
Last activity: Oct 3, 2020, 09:06 AM