What is the database?
You could use the database know functions or you could use something like
this.
<cfset pastDate = dateAdd('day', -30, now());
And then do a between that date and now in the query.
--
Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+: http://plus.google.com/108193156965451149543
On Thu, Sep 22, 2011 at 11:41 PM, Imperial, Bob <[email protected]>wrote:
>
> Hi folks,
>
> My brain is slow to grasp how to pull records from a database to get only
> the last 30 days. I have a scheduled task that currently grabs everything
> but I have a request to only include the last 30 days in the report that is
> generated.
> Running MySQL and CF9. I've tried running the following using the query
> tool in mysql but it returns an error:
> SELECT * FROM myTable
> WHERE dateAdded BETWEEN CURDATE() AND DATE_SUB(CURDATE)(), INTERVAL 30 DAY)
>
> In need of enlightenment here. TIA
>
> Bob
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5608
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm