0

I have a table containing rows that I want to Group By days using creationdate column that has the following format: yyyy-MM-dd HH:mm:ss. How would I extract the yyyy-MM-dd part from this column (using datetime function?) so that this query would work:

SELECT creationdate, count(*) as c FROM clients GROUP BY creationdate.

Example table:

clients
---------------

id   name   creationdate

0    a      2015-03-01 10:11:58
1    b      2015-04-18 22:14:35
2    c      2015-04-18 14:25:07

The above query will output three groups but there should be two.

astralmaster
  • 2,344
  • 11
  • 50
  • 84

1 Answers1

1

How about:

select date(creationdate), count(*) as c from clients group by date(creationdate)
smilin_stan
  • 1,693
  • 2
  • 28
  • 40