Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query with function, maybe

Status
Not open for further replies.

kenadys

Technical User
Aug 14, 2002
13
0
0
US
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)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top