I have a query based on a date range.
How can I code it to retrieve the date range I enter
and the same date range for the following year.
So the report will contain both.
You need to know 2 things that depend on your DB, on the reporting tool, and on the way the parameters are defined:
1)how to use parameters in the SQL;
2)how to find the date 1 year from the given.
Then you can get the result with the UNION query. Like:
(select * from ... where date>=param1 and date<=param2)
UNION
(select * from ... where date>=param1inayear and date<=param2inayear)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.