Hey all,
I'm having trouble trying to write a sql server query grouped on a datetime
field. The problem is that since the time is included in the field, the date
isn't really grouping well. I know of a datepart function but get an error when
I try it. Any help?
This sql statement groups all pages by the second. How do I split off just the
date part? left(datetime,11)?
select count(datetime) as dt, [datetime]
from sitelog
where datetime >= '2007-02-03 00:00'
group by [datetime]
order by [datetime] desc
Ahah! There it is. Nevermind.
select left(datetime,11), count(*) as dt
from sitelog
where datetime >= '2007-02-03 00:00'
group by left(datetime,11)
order by left(datetime,11) desc
Well, now that I look at it, the order by is ordering by "jan 1 2006" etc in
desc alphabetical order. How do I get this field to be sorted by yyyy-mm-dd?
Do I have to go through all this...
http://www.databasejournal.com/features/mssql/article.php/10894_2197931_2
Michael
--------
Michael Muller
Admin, MontagueMA.net Website
work (413) 863-0030
cell (413) 320-5336
skype: michaelBmuller
http://www.MontagueMA.net
Eschew Obfuscation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http: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:268769
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4