Created
November 11, 2013 10:42
-
-
Save IronistM/7411253 to your computer and use it in GitHub Desktop.
This code sets variables to define a time period (previous calendar month) dynamically changing the SQL statement sent to source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let vLastMonth = Year(AddMonths(now(),-1)) & '-' & num(month(addmonths(now(),-1)),'00') & '-01'; | |
// This gets the first of the previous month | |
let vThisMonth = Year(now()) & '-' & num(month(now()),'00') & '-01'; | |
// This gets the first of the current month | |
ODBC CONNECT TO MyDSN; // Change to your database | |
LOAD *; | |
SQL SELECT | |
DATE, | |
NAME, | |
CODE | |
FROM MyTable | |
WHERE DATE >= '$(vLastMonth)' AND | |
DATE < '$(vThisMonth)'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment