Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
baarathi
Creator III
Creator III

Addmonths

Load *;

Sql select

* from dm.db

Where monthstart([YourMonthYear])  >= monthstart(addmonths(today(),-12));


Is there any equivalent function function for addmonths in sql ?

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

It depends on the SQL dialect that your database is using. The SQL statement in Qlik sends everything after the SQL and before the semicolon to the database driver that you are using and it is up to the SQL database and driver to interpret it and return some results.

For Microsoft SQL Server you can use the DATEADD( month , 1 , SalesDate ) as an example.

For Oracle you can use ADD_MONTHS( SalesDate , 1 ) as another example.

So you will have to look at the documentation for your particular SQL database.

View solution in original post

2 Replies
petter
Partner - Champion III
Partner - Champion III

It depends on the SQL dialect that your database is using. The SQL statement in Qlik sends everything after the SQL and before the semicolon to the database driver that you are using and it is up to the SQL database and driver to interpret it and return some results.

For Microsoft SQL Server you can use the DATEADD( month , 1 , SalesDate ) as an example.

For Oracle you can use ADD_MONTHS( SalesDate , 1 ) as another example.

So you will have to look at the documentation for your particular SQL database.

baarathi
Creator III
Creator III
Author

Thank you sir.