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

by scotty_walker , in category: MySQL , 6 months ago

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

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by jerad , 6 months 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.

Related Threads:

How to use case with condition inside a function in mysql?
How to implement lag function in teradata?
How to call function inside function in codeigniter?
How to use model function result in controller by codeigniter?
How to mock a function with a promise inside in Javascript?
How to call function inside procedure in PostgreSQL?