Complicated query with GROUP BY and range of prices in MySQL

nokiss

New Member
In my DB table, I have a lot of products (several of which the same product). If the product in table is e.g. 5 times, so first could be its price $10, then $20, $30, $40 and $50.I am trying to make a statement, where will be every product printed just once, and if the product will be stored in table e.g. 5 times as above, so I would like to print about this product also prices range. Example:\[code\]Mobile phone: $300Bicycle: $1000T-Shirt blue: $10 - $30\[/code\]Exist any elegant way to do?
I am trying to do following way:\[code\]Product.find:)all, :per_page => 20, :page => page, :group => "name", :eek:rder => name)\[/code\]But as I wrote above, I am thinking about an option, how to get the range of prices... Is it possible to do in one query?
 
Top