Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Record Counting

From: ranjeet walunj <ranjeet.walunj(at)gmail.com>
Date: Tue Oct 30 2007 - 15:11:37 EDT


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

Regards,
Ranjeet Walunj

-- 
MySQL General Mailing List
For list archives: 
http://lists.mysql.com/mysql
To unsubscribe:    
http://lists.mysql.com/mysql?unsub=lists@pantek.com
Received on Tue Oct 30 15:12:37 2007

This archive was generated by hypermail 2.1.8 : Thu Jul 03 2008 - 08:43:32 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library