Page 1 of 1

[MySQL] Number of items between range

Posted: Tue Nov 13, 2007 1:12 pm
by Bizzy
Hey guys,

can you help me with following problem?

Code: Select all

CREATE TABLE `items` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `price` int(11) default NULL,
  PRIMARY KEY  (`pid`)
)
I need to get results like this:

Code: Select all

price range | number of items
0-50 | 0
0-100 | 6
0-150 | 7
0-200 | 8
Thanks for help.