You could do it several different ways, most depending on your db of choice.

This is for mySQL:

<cfset firstOfThisMonth =
DateFormat(CreateDate(Year(Now()),Month(Now()),"01"),"yyyy-mm-dd")>
<cfset firstOfLastMonth =
DateFormat(DateAdd("m",-1,firstOfThisMonth),"yyyy-mm-dd")>
<cfset lastOfLastMonth =
DateFormat(DateAdd("d",-1,firstOfThisMonth),"yyyy-mm-dd")>

SELECT id, name
FROM news
WHERE post_date BETWEEN '#firstOfLastMonth #' AND '#lastOfLastMonth #'

<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Claremont, Timothy [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 21, 2005 1:01 PM
To: CF-Talk
Subject: All Items From LAST month


My records get time stamped when they are entered. It is a simple
date/time field.

What is the correct syntax for retrieving ALL records entered LAST
MONTH.

So, if today (Now()) is ANY day in September, show me all the records
entered in August.

TIA,
Tim

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please delete it
from your system.

This footnote also confirms that this email message has been swept for
the presence of computer viruses.

Thank You,
Viahealth
**********************************************************************




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218827
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to