Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I have SQL table and column Date.
Is it possible to make WHERE limited selection in order to get only records with Data for last tree month..... like
InMonth(Date,Today(),-3)
If you are doing the comparison on the SQL Where clause, you can use the SQL syntax supported by your server - for example, in SQL Server
SQL SELECT *
From dbo.MyData
Where Date >= DateAdd(m, -3, GetDate());
MySQL, Oracle etc will have different syntax - but this avoids date formatting issues.
Create a Variable as below
Let vTodayMinus3Month = AddMonths(Today(),-3);
Now load as per
TableName:
Load * From TableName Where Date >= '$(vTodayMinus3Month)';
create a variable for that 3mnths and use it in load stmnt..
If you are doing the comparison on the SQL Where clause, you can use the SQL syntax supported by your server - for example, in SQL Server
SQL SELECT *
From dbo.MyData
Where Date >= DateAdd(m, -3, GetDate());
MySQL, Oracle etc will have different syntax - but this avoids date formatting issues.
Hi Ruslans,
You can do these using variables,
LET vStartDate= Monthstart(Addmonths(Today(),-3))
so by these variable it will consider like for today it will take then it will return , 01/10/2015
after that you can use that variable inside SQL statement by,
Last3MDATA:
LAOD *;
SQL SELECT *
From dbo.MyData
Where Date >= $(vStartdate);
Note:Please check the date format in every area(DD/MM/YYYY or YYYY-MM-DD)
Regards,
Koushik
Thanks, that is exactly what I wanted.