I have a table:
CREATE TABLE `moviehits` (
  `title` varchar(5) NOT NULL default '',
  `movie` varchar(4) NOT NULL default '',
  `hit_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `ip` varchar(15) NOT NULL default '',
  `listing_id` int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;

That I would like to grab stats by title, something along the following:
select count(movie),hit_date,movie from moviehits where hit_date between
'2004-04-01' and '2004-04-31' and title='33329' group by hit_date

Of course, when I do the group by for the hit_date, it does not group hits
by day because of the time element.

Is there a way to use the existing database structure to get hits by date
using a group by clause of some sort?

select count(movie),hit_date,movie from moviehits where hit_date between
'2004-04-01' and '2004-04-31' and title='33329' group by
date_format(hit_date,"%Y-$m-%d")

Or something along those lines?

Tia!

--
Cheers

Mike Morton

****************************************************
*
* Tel: 905-465-1263
* Email: [EMAIL PROTECTED]
*
****************************************************

"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to