SQL Trigger Value - First Week of Year

  • 5 September 2022
  • 0 replies

Hi there!


I’m finding the SQL Trigger Value logic a bit confusing. I’m working in Amazon Redshift, and looking at refreshing my PDT once we hit the first day of the first week of the year (so that we store the previous financial year i.e. Week 1 to 52/53 in the PDT until the following year) 

I’m looking at using `SELECT CASE WHEN date_part(week,current_date) = 1 AND date_part(dayofweek ,current_date) = 1 THEN TRUE ELSE FALSE END` so that it’s always False until the first day of the first week of the year, but I’d love to know if this is the most optimal way or if anybody has used any other methods?


Thank you! 

This topic has been closed for comments