You can translate the question and the replies:

Return Data for the past months

Hi I'd like to query the teradata query in denodo VQL, however I cant able to get the syntax right. SELECT ADDMONTH(ADDMONTH(CURRENT_DATE, -12), (EXTRACT(MONTH FROM ADDDAY(<field_name> , -12 ) -6 ))) Any pointers would be appreciated. Thank you.
28-11-2023 00:26:38 -0500

1 Answer

Hi, In general, the function [ADDMONTH]( has two parameters where the first parameter specifies the column name (which has the Datetime expression) and the second parameter is an integer to be incremented. Also, the function [ADDDAY]( has two parameters, one for mentioning the column_name (which has the Datetime expression) and the other for the integer to be incremented. In both the functions, the integer could either be a positive or a negative value. Please find below the syntax for the functions to work as expected: ``` SELECT ADDMONTH(ADDMONTH(<column_name>, -12),(EXTRACT(MONTH FROM ADDDAY(<column_name> , -12 )))) from <view_name>; ``` For further information, please refer to the [DATATIME FUNCTIONS]( document below the Virtual DataPort VQL Guide section. If you still need further assistance and if you are a valid support user, you can raise a [Support Case](, for further assistance from the Support Team. Hope this helps!
Denodo Team
30-11-2023 00:34:45 -0500
You must sign in to add an answer. If you do not have an account, you can register here