yeah, i hadn't thought about the years thing :)

And Barney's most certainly right about the speed.  setting 2 vars
(start date, end date) is quicker than running a function on every
record to get the month value.

but...in my defense, you wouldn't have any issues in January since my
method isn't simply subtracting 1 mathematically, but subtracting one
month from the current date :)

still, I'd go with the BETWEEN route and setting the start/end dates.

On 9/21/05, Tim Claremont <[EMAIL PROTECTED]> wrote:
> Also, what happens when I try to run this method in January, and it attempts 
> to subract "1" from the month number?
>
>
>
>
> > Charlie,
> >
> > The problem I see off the bat is when I get to future years, it will
> > retrieve records from all years, as long as the MONTH matches.
> >
> > No matter, though. I am on the right track and will modify your
> > suggestion accordingly.
> >
> > Thanks!
> >
> >
>
> >
> >
> > >there's probably a pure SQL way to do it too, but since I'm better
> > >with CF than SQL, my hybrid solution would be:
> > >
> > ><cfset lastMonth = month(dateAdd('m', -1, now())) />
> > >
> > ><cfquery name="myQuery" datasource="myDSN">
> > >     SELECT
> > >          columns
> > >     FROM
> > >          tablename
> > >     WHERE
> > >          month(myDateColumn) = #lastMonth#
> > ></cfquery>
> > >
> > >standard disclaimer about being untested, could cause warts, etc.
> > >
> > >
> > >On 9/21/05, Claremont, Timothy <[EMAIL PROTECTED]>
> > wrote:
> >>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:218841
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