I have a classic ASP application that uses a config file to specify certain control information. The query below works fine, however I would prefer to store the config info in a table in the database and use it from there. Would this be possible?

Here is the query. The &right, &month and &year are VBScript functions and the Yearstart is in the config file.

Regards and thanks

"Select round(Sum(weeklytransactions.takings), 2) As Gross, round(Sum(If(departments.vat, If(weeklytransactions.weekendingdate Between '2011-01-04' And '2099-12-31', weeklytransactions.takings / 1.2, If(weeklytransactions.weekendingdate Between '2008-11-30' And '2010-01-01', weeklytransactions.takings / 1.15, weeklytransactions.takings / 1.175)), weeklytransactions.takings)), 2) As net, Week(weeklytransactions.weekendingdate), weeklytransactions.weekendingdate As wkend, round(datediff(weekendingdate, (if(month(weekendingdate)>"&month(YearStart)-1& ",concat(year(weekendingdate),'-"&right("00"&month(YearStart),2)& "-01'),concat(year(weekendingdate)-1,'-"&right("00"&month(YearStart),2)& "-01'))))/7,0)+1 as fyweek, cast((Case When Month(weeklytransactions.weekendingdate) >"&month(YearStart)-1& " Then Concat(Year(weeklytransactions.weekendingdate), '-',Year(weeklytransactions.weekendingdate) + 1) Else Concat(Year(weeklytransactions.weekendingdate) - 1, '-',Year(weeklytransactions.weekendingdate)) End) as char) As fy From departments Inner Join weeklytransactions On departments.deptid = weeklytransactions.departmentId Group By weeklytransactions.weekendingdate Order By fy Desc, wkend Desc Limit 1"