-
-
Save cgi-ace/fb260d80b94c8b41a0562a0bbf2c397a to your computer and use it in GitHub Desktop.
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
---- First day and last day of a month for dynamically using it in _TABLE_SUFFIX | |
with tablemonth as ( | |
SELECT CAST(FORMAT_DATE("%Y%m%d",DATE_TRUNC(CURRENT_DATE(), MONTH)) as string) as st_date_month, | |
CAST(FORMAT_DATE("%Y%m%d",DATE_SUB(DATE_TRUNC(DATE_ADD(CURRENT_DATE(), INTERVAL 1 MONTH), MONTH), INTERVAL 1 DAY)) as string) as end_date_month | |
) | |
select * from tablemonth |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment