In SQL, look at the BETWEEN operator:

SELECT * FROM dbo.PaP 
WHERE test_date BETWEEN #CreateODBCDate(startDate)# AND
#CreateODBCdate(endDate)#
ORDER BY #sort# ASC


Adam.


> -----Original Message-----
> From: Kennerly, Rick H CIV [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 19, 2003 9:17 AM
> To: CF-Talk
> Subject: Q_Range of dates
> 
> 
> I think I've got a handle on queries for output forms where 
> they are passed
> a single month/year.  
> 
> However, what would a query for a range (such as JAN 2003 to 
> MAR 2003 or JAN
> 2003 to DEC 2003) look like?  
> 
> Here's where I am.
> 
> <cfset startDate=CreateDate(Form.startYear, Form.startMonth, 1)>
> <cfset endDate=DateAdd (Form.endYear, Form.endMonth,1)>
> <cfquery name="qDateRange" datasource="ds">
> SELECT * FROM dbo.PaP WHERE test_date >= #CreateODBCDate (startDate)# 
> AND test_date < #CreateODBCdate (endDate)# ORDER BY #sort# ASC 
> </cfquery> 
> 
> Rick
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to