Hi, I have a table where I keep sales transactions, so I'm trying to do a query that will count the number of transactions per day.
My test data looks like: -- -- Table structure for table `sales_activity` -- CREATE TABLE `sales_activity` ( `sales_id` int(11) NOT NULL auto_increment, `sales_date` datetime NOT NULL default '0000-00-00 00:00:00', `sales_type` tinyint(4) NOT NULL default '0', PRIMARY KEY (`sales_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; -- -- Dumping data for table `sales_activity` -- INSERT INTO `sales_activity` VALUES (1, '2008-06-15 13:00:00', 1); INSERT INTO `sales_activity` VALUES (2, '2008-06-15 13:00:00', 1); INSERT INTO `sales_activity` VALUES (3, '2008-06-15 13:00:00', 1); INSERT INTO `sales_activity` VALUES (4, '2008-06-15 13:00:00', 1); INSERT INTO `sales_activity` VALUES (5, '2008-06-15 13:00:00', 2); INSERT INTO `sales_activity` VALUES (6, '2008-06-15 13:00:00', 2); INSERT INTO `sales_activity` VALUES (7, '2008-06-16 13:00:00', 1); INSERT INTO `sales_activity` VALUES (8, '2008-06-16 13:00:00', 1); INSERT INTO `sales_activity` VALUES (9, '2008-06-17 13:00:00', 1); INSERT INTO `sales_activity` VALUES (10, '2008-06-17 13:00:00', 1); I would like to get a count of the number of transactions where transaction id=1 for each date. ie, the result set should look like: 2008-06-15 4 2008-06-16 2 2008-06-17 2 What type of query do I need to get that information? Thanks!