how do I simply date range query?
Posted on 2009-12-17
Greetings SQL Gurus,
I currently have the following:
sql="select * from mytable where id = "&givenID& " " & _
" and startDate >'1/1/1900' and startDate < '"&givenDate&" ' " & _
" and endDate >' " &givenDate& " ' " & _
" and endDate < ' " ¤tDate& " ' "
On the webform, it is setup like this:
From: 1/1/2009 To: 12/17/2009
From: 10/1/2000 To: 12/17/2009
From for either StartDate or EndDate could be any date between 1/1/1900 and currentdate and in our example, today's date (which is currentdate) is 12/17/2009
Same with To for either StartDate and EndDate
Here is my question:
As you can see, I am using 4 parameters from, from, to, to)
Is it possible to just use:
StartDate: 1/1/900 (or whatever date range I wish to use) EndDate: 12/17/2009 or whatever date range I wish to use?
Is this possible?
Many thanks in advance