This topic is locked

Advanced Queries Using Dynamic Week number

12/16/2003 12:06:57 PM
ASPRunnerPro General questions
author

I am trying to retieve data from a databse based on the week number, but the week number must be determined dynamically on the fly using a function like:

select week(sysdate())


so my query should look something like this:

SELECT *

FROM `timesheettest` where weeknum = (select week(sysdate()))


Can this be done using ASPRunner and a MySQL database?

admin 12/16/2003

Hi,
you can use VBScript functions to get current day of week:

strSQL = "SELECT * FROM `timesheettest` where weeknum = " & weekday(now())


or use MySQL functions to achive the same:

strSQL = "SELECT * FROM `timesheettest` where weeknum = weekday(CURDATE())"


Best regards,

Sergey Kornilov