[MySQL] Number of items between range

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Bizzy
Forum Newbie
Posts: 10
Joined: Mon Apr 16, 2007 1:15 pm

[MySQL] Number of items between range

Post 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.
Post Reply