Depends on what you're trying to do.  Do you want everything between today 
and the date three months from today?  For instance 5/17/2005 to 
8/17/2005.  Or do you want everthing from the beginning of May through the 
end of July?

The latter could be done with

<cfset startdate = CreateDate(Year(Now()), Month(Now()), 1)>
<cfset threemonths = DateAdd("m", 3, startdate)>
<cfset enddate = CreateDate(Year(threemonths), Month(threemonths),
                            DaysInMonth(threemonths))>

WHERE event_date BETWEEN startdate AND enddate



----- Original Message ----- 
From: "Les Mizzell" <[EMAIL PROTECTED]>
To: "CF-Talk" <cf-talk@houseoffusion.com>
Sent: Wednesday, May 17, 2006 10:28 PM
Subject: Re: ARGH! - Three Months in the future query problem


> Duh!
>
> This does it:
>
> WHERE event_date < #threemonths# and
>       event_date >= #startDATE#
>
> See! Getting away from the computer and thinking about things while
> walking your dogs really helps!!
>
>
>> <cfset startDATE = #now()#>
>> <cfset threemonths = DateAdd("m",3,startDATE)>
>>
>> <cfquery name="calendar">
>> SELECT
>> id, event_date, event_name FROM events
>> WHERE month(event_date) >= #month(startDATE)#
>>       and event_date < #threemonths#
>>       and year(event_date) >= #year(startDATE)#
>> ORDER BY event_date,event_time ASC
>> </cfquery> 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240877
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to