House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

MySQL question

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Che Vilnonis
05/07/2012 03:57 PM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Azadi Saryev
05/07/2012 08:04 PM

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 -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 25, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference