How to use a subquery inside an interval function in teradata?

by scotty_walker , in category: MySQL , 22 days ago

How to use a subquery inside an interval function in teradata?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by jerad , 21 days ago

@scotty_walker 

You can use a subquery inside an interval function in Teradata by following the syntax below:

1
2
3
SELECT column_name
FROM table_name
WHERE date_column BETWEEN current_date - INTERVAL (SELECT interval_value FROM interval_table) DAY AND current_date


In this example, the subquery is used to retrieve the interval value from a separate table. The subquery should return a single value that can be used as the interval in the INTERVAL function.