Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query question

Status
Not open for further replies.

lucidtech

IS-IT--Management
Jan 17, 2005
267
US
I'm trying to pull records from a database where the data in a column is the same date as today. Am I missing something here because I keep getting an error...

<cfquery name="test">
SELECT last_date
FROM users
WHERE <cfoutput>DateDiff("d", last_date, now())</cfoutput> = <cfqueryparam value="0" cfsqltype="cf_sql_integer">
</cfquery>
 
which database? db2? informix? sybase? firebird? postgresql?

no, let me guess -- microsoft access

WHERE last_date = Date()

by the way, have a look at your SELECT clause

all you are pulling out is the date, which you already know is going to equal today!

how useful can that be??? :)

r937.com | rudy.ca
 
Thank you for the help... I'm not pulling the date, I just posted a hypothetical query.
 
It didn't work necessarily, but that is not fault of your own. I'm a bit stubborn when it comes to figuring things out for myself (I just retain the knowledge better that way) so I didn't post exactly what I needed, but your post definitely made me think outside the box so to speak, and made me realize there is another way to do it.

I was trying to check which users had been online in the last hour actually... and by setting a date to match today and a time that matches an hour ago as variables, I can use them in the WHERE clause to get my result.

Thanks again. I was bumming for a while there cuz it seemed to me that this site was down for a month or so, and I come here to get help a lot.
 
Will do... anyone who would rather me just be told how to do something rather than have me learn for myself should do the same. LOL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top