what RDBMS are you using?  use the DB for this...in Oracle...asumming I'm awake and typing correctly....


<CFQUERY NAME="newphotos" >
SELECT      *
FROM mytable
where sysdate - date_added  >= 2

</CFQUERY>


Note that this does not get what you stated you wanted though.
"within the last 48 hours."
would actually be sysdate - date_added <= 2

Doug

-----Original Message-----
From: Jeff Fongemie [mailto:[EMAIL PROTECTED]
Sent: Monday, October 27, 2003 10:32 AM
To: CF-Talk
Subject: query database new (date related) records?

Hey everyone, this should be easy.

So why can't I get this to work?

I want a query that will return records made within the last 48 hours.
I'll use a field called date_added that records the date the record was made using now().

I need something like this:

<cfset today = now()>
<cfset twodaysago = today less two days>

<CFQUERY NAME="newphotos" >
SELECT      *
FROM mytable
where date_added > twodaysago

</CFQUERY>

I think this could work, but I'm not getting the <cfset twodaysago = today less two days> part to work.

Or, there is a better way?

Jeff

  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to