Thanks, Carl & Ian for the latest suggestion
on using the simplied dateDiff & curdate.
That seems to work fine.

Running:

select  totalNew
from            04a_dailyNumberNewHMLSProperties
where   dateDiff(curdate(),dateOfTotal) = 1

does return the correct number for "yesterday", 927.

And running:

select  totalNew
from            04a_dailyNumberNewHMLSProperties
where           dateDiff(curdate(),dateOfTotal) = 0

returns the correct number for "today", 901.

How simple and elegant!

I can feel my headache being soothed already.  Time
to quit for the day!

Thanks, again!

Rick

-----Original Message-----
From: Carl Von Stetten [mailto:[email protected]] 
Sent: Friday, November 05, 2010 6:52 PM
To: cf-talk
Subject: Re: I think I'm just making this way too hard...


Rick,

I think you might be able to simplify this further, and take ColdFusion out of 
the query altogether.  Bear in mind I've never used MySQL, but according to the 
MySQL docs something like this should work:

select     totalNew
from       04a_dailyNumberNewHMLSProperties
where      datediff(curdate(),dateOfTotal) = 1

The DateDiff(expr1,expr2) function "returns expr1 – expr2 expressed as a 
value in days from one date to the other. expr1 and expr2 are date or 
date-and-time expressions. Only the date parts of the values are used in the 
calculation."

HTH,
Carl




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:338885
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to