Christopher Jordan wrote:
>
> Results in:
> WHERE timereceived >= {d '2006-12-20'} AND
> timereceived <{d '2006-12-22'}
>
> I haven't tried it, but if the datatype on the field is 'ts' and you're
> trying to compare it with just 'd' (meaning it's holding data like, {ts
> '2006-12-20 13:43:24'} and you're trying to compare using {d
> '2006-12-20}). I'm not positive that will work. It may. I dunno.
If you just provide the date part, the DB will assume midnight for the
time part...
{d '2006-12-20'} = {d '2006-12-20 00:00:00'}
>
> Also, is it faster to compare the way you suggest instead of using the
> in-built SQL BETWEEN statement? I would *guess* that using BETWEEN is
> faster. For small amounts of data the time difference may be
> immeasurable, but over lots of records (hundreds of thousands?
> millions?) the time difference might be significant... but that's just
> my guess. I'm no SQL guru. Not by a long shot. :o)
>
I'm not sure it is any faster one way or the other, I think the BETWEEN
keyword is really just a shortcut that means the same thing as >= AND
<=. The only reason I changed it was so that it did not include the
end date/time(right hand is just <). I find that easier than using
BETWEEN and creating a datetime that is the last possible time in the
previous day...especially when you start dealing with milliseconds.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:264730
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4