You could try something like....

<CFQUERY name="findRecent" datasource="Categories">
        SELECT * 
        FROM Links 
        WHERE DateAdded BETWEEN <CFQUERYPARAM
VALUE="#CreateODBCDateTime(DateAdd('d', -3, Now()))#"
SQLTYPE="CF_SQL_TIMESTAMP"> AND <CFQUERYPARAM VALUE="#Now()#"
SQLTYPE="CF_SQL_TIMESTAMP">
                AND approve=1
        ORDER BY DateAdded DESC
</cfquery>  


Or something like that

HTH

Mikey



-----Original Message-----
From: Jake McKee [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 17, 2003 17:41
To: CF-Talk
Subject: Problems with date based query


I have been banging my head against a wall for a while. 

 

I have a table of records in Access. I need to find all the records that
were entered from 3 days ago to right now. This is the code:

 

 

<CFSET timing = #DateAdd('D',-3,Now())#>

 

<CFQUERY name="findRecent" datasource="Categories">

            SELECT * 

                                    FROM Links 

                                    WHERE DateAdded >= #DateFormat(timing,
"m/d/yyyy")#

                                    AND approve=1

            ORDER BY DateAdded DESC

</cfquery>       

 

 

(DateAdded is a date/time field in access with dates formatted as
7/17/2003)

 

This only succeeds in bringing back every record in the DB. If I change the
"WHERE" line to "=", rather than ">=", I don't get any records (even though
there are several that fit this)

 

What am I overlooking?

Thanks in advance

Jake



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

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

Reply via email to