Hi guys,
In Access u can do something like the following in ur query:
SELECT...
WHERE (weekendingEmp.WeekEnding)>(DateAdd("ww",-3,Now()))
Now() function will get the current system date.
1st parameter which is "ww" means that it will add number of weeks to the current system date according to number specified by the 2nd parameter..
so basically, this query will use DateAdd function as part of WHERE statement and collect data from 3 weeks ago up to today...
unfortunately, i can't use Access object anymore and i need to use ADO.. i believe regular SQL statement doesn't understand "DateAdd" function so my question is.. does anyone kno how i can come around this problem w/out using DateAdd function?
thanksIt depends on the DB you are using. If you are using SQL Server, you can do the exact same thing with:
SELECT...
WHERE (weekendingEmp.WeekEnding)>(DATEADD(ww,-3,GETDATE()))
Tuesday, February 14, 2012
DateAdd function
Labels:
access,
database,
dateadd,
following,
function,
guys,
microsoft,
mysql,
oracle,
queryselect,
server,
sql,
weekending,
weekendingemp
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment