List:General Discussion« Previous MessageNext Message »
From:ranjeet walunj Date:October 30 2007 7:11pm
Subject:Re: Record Counting
View as plain text  
> > Neil Tompkins wrote:
> > > I have a table of records all of which have a timestamp against them
> > like 2007-10-25 10:10:19, and category like red, blue etc and a unique key.
> > >
> > > Using a SELECT statement is it possible to retrieve the count and number
> > of records for each day e.g 2007-10-25 for all red, and all blue etc

Hi neil.

I would use
SELECT count(colour_field_name) AS Counter,
DATE_FORMAT(datetimecol,'%y-%m-%d') as Date, colour_field_name FROM
table_name GROUP BY Date, colour_field_name;

Ranjeet Walunj
Record CountingNeil Tompkins27 Oct
  • Re: Record CountingRavi Kumar.27 Oct
  • Re: Record CountingPeter Brawley27 Oct
    • Re: Record CountingRavi Kumar.28 Oct
      • Re: Record Countingranjeet walunj30 Oct