Answer is that yes its possible.  And, you're doing it almost the right way.
The problem could be the format of your dates.  Actually, I think you have
your LT / GT symbols reversed too...GT now and LT an hour ago?

The first observation that I'll make is that you don't need to put a late
bound on your date.  If its in the database and created 1 second from now,
do you want to include it?  Yes, its less than an hour old.  There could be
a difference between server times or a slight delay in processing, so this
could happen.

Second - I'd use SQL functions for all the date stuff to absolutely ensure
format compatibility.  In Oracle, this query would look like:

<CFQUERY name="name" datasource="#ds#">
Select * from tablename
where fieldname  = fielddata
and createdate > (sysdate - (1/24) )
</CFQUERY>

Oracle date arithmetic is based on days, so 1/24 is one hour.  Adjust for
MSSQL...

Brian


-----Original Message-----
From: Kevin Davis [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 06, 2001 10:59 AM
To: CF-Talk
Subject: one hour query


Is it possible to write a query that retrieves data from the data source for
the last hour?

for Ex...

<CFQUERY name="name" datasource="#ds#">
Select * from tablename
where fieldname  = fielddata
and createdate >= #Hour(Now())#
and createdate <= #Hour(Now()-1)#
</CFQUERY>

or something like that. (The above query doesn't seem to work for me.)

I have looked though the CF manuals, searched my email achieves and have
been out to Allaires forms site and haven't been able to find anything.  

Any help would be greatly appreciated. 

Thanks,

Kevin Davis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to