All pastes #232761 Raw Edit

Stuff

public text v1 · immutable
·published 2006-11-01 14:56 UTC
rendered paste body
The url:

SELECT statsProduct.idProduct, count(statsProduct.idProduct) AS visits, product.productname FROM statsProduct, product WHERE tstamp >= '$date' GROUP BY idProduct ORDER BY visits DESC limit 20

The table

CREATE TABLE `statsProduct` (
  `idProduct` int(8) NOT NULL auto_increment,
  `tstamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `ip` varchar(12) NOT NULL default '',
  KEY `idProduct` (`idProduct`),
  KEY `timestamp` (`tstamp`),
  KEY `ip` (`ip`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=33 ;