var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: help on getting a range from dates
Need help on this situation..
I need to extract results of a query basing on the selected range of dates by the user ....
date1 = 01/01/2009
the table for this query is:
how could i refer this into a query where date1 = datetime and date2=enddate
I tried using the query With a where clause "startdate between date1 and date2" but it ishould be between the startdate and enddate
declare @date1 datetime,@date2 datetime
select @date1 = '01/01/2009',@date2 ='03/31/2009'
select * from urtable where dateadd(d,0,datediff(d,0,startdate)) > dateadd(d,0,datediff(d,0,@date1)) AND dateadd(d,0,datediff(d,0,endate)) < dateadd(d,0,datediff(d,0,@date2))
Originally Posted by
thanks this got my problem right again thanks
HI again the solution of bklr was doing fine until i tried a range with the same month example @date1 ='01/01/2009' and @date2='31/01/2009' the problem with this range is it doesn't include records that starts on january but ends on the succeeding months unless i specify the @date2 ='02/31/2009' etc... how could i modify the code so that the record will show
thanks that made the query right with all the explanations it helped me a lot