>
> 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>
>
<cfset today = now()>
<cfset twodaysago = dateadd("d",-2,today)>
> <CFQUERY NAME="newphotos" >
> SELECT *
> FROM mytable
> where date_added > twodaysago
> </CFQUERY>
>
<cfquery name="newphotos" datasource="yourdatasourcename">
SELECT *
FROM mytable
WHERE date_added > #createodbcdate(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?
>
You could also do this directly with an SQL statement, but the form it
takes will differ depending on your database.
Regards
Stephen
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

