|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
MySQL question
Should be a simple one for a mysql guru. What is the mysql equivalent of theChe Vilnonis 05/07/12 03:57 P select day(`timestamp`) as dayOfMonth, count(`timestamp`) as searchesPerDayAzadi Saryev 05/07/12 08:04 P Should be a simple one for a mysql guru. What is the mysql equivalent of the following? select datePart(dd,timestamp) as dayOfMonth, count(timestamp) as searchesPerDay from mytable where (timestamp between '5/1/2012 00:00:00' and '5/31/2012 23:59:59') group by datePart(dd,timestamp) order by datePart(dd,timestamp) asc Thanks, Che select day(`timestamp`) as dayOfMonth, count(`timestamp`) as searchesPerDay from mytable where `timestamp` between '2012-05-01 00:00:00' and '2012-05-31 23:59:59') group by dayOfMonth order by dayOfMonth asc iirc, timestamp is a reserved word in MySQL - hence it's enclosed in ticks above (note that ticks are NOT single quotes). MySQL also allows you to use column aliases in group by and order by statements. ----- Excess quoted text cut - see Original Post for more -----
|
May 25, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||