Leveraging TIMESTAMP SQL Expressions to Retrieve Relative Date Ranges
With the help of TIMESTAMP SQL expressions, analyzers can build customized reports with relative date ranges, not currently offered as a built-in feature in Insight.
TIMESTAMPADD manipulates data of the data types DATE and DATETIME based on a calendar year.
Syntax: TIMESTAMPADD(interval, expr, timestamp)
Example: TIMESTAMPADD(SQL_TSI_MONTH, -12, CURRENT_DATE)
Timestamp Interval (TSI) Options:
- SQL_TSI_SECOND
- SQL_TSI_MINUTE
- SQL_TSI_HOUR
- SQL_TSI_DAY
- SQL_TSI_WEEK
- SQL_TSI_MONTH
- SQL_TSI_QUARTER
- SQL_TSI_YEAR
Below, I will present two use cases where the TIMESTAMP function has been employed to generate reports showcasing dynamic date range outcomes.
Tagged:
2