How could this query be coded?
I'm racking my brain trying to figure this one out...this is an old query of mine being retooled...
DB has a field for MONTH and a field for YEAR...as well as HOURS for each record.
This query is pulling a sum of hours for a date range, that will be a year from Oct to Sep.
So I want a query that says:
Select * from October to December of Last Year, AND all months from January of the current year up to a "selected" month.
I have setup for current year, prior year, and selected month (from a dropdown list).
I've already tried something like:
SELECT SUM(hours) AS Total FROM TABLENAME
WHERE service_year = #session.prior_year# AND service_month >= 10 AND service_month <=12 AND service_year = #session.selected_year# AND service_month >= 1 AND service_month <= #session.selected_month#
No dice of course, logically that doesn't work anyway after looking at it.
Any ideas? I've tried various forms of evaluation levels of operators, no dice.
Thanks in advance! ![]()