Charlie's method prevents the use of an index on the timestamp column.
 Probably not a big deal, because there probably isn't one, but it's
something to consider.  I'd imagine that it's also slower in general,
because EVERY record has to have a date operation performed as well as
a comparison, while using CF to create a range (as you and I proposed)
only requires a couple date operations regardless of the number of
records.

cheers,
barneyb

On 9/21/05, Andy Matthews <[EMAIL PROTECTED]> wrote:
> That's a nice one Charlie. Much simpler than mine.
>
> <!----------------//------
> andy matthews
> web developer
> ICGLink, Inc.
> [EMAIL PROTECTED]
> 615.370.1530 x737
> --------------//--------->
>
> -----Original Message-----
> From: Charlie Griefer [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 21, 2005 1:22 PM
> To: CF-Talk
> Subject: Re: All Items From LAST month
>
>
> 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.
>

--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 100 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218836
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to