View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 11:27 AM
howa
 
Posts: n/a
Default Group by Top x ?

Consider a query like, e.g.

SELECT GROUP_CONCAT(id) FROM `products` GROUP BY `brand`;

Then the result will be product id string group by brand name


However, I want to limit the GROUP_CONCAT() only return the top 3
products of each brand, say, by price

How to do this?

Thanks.

Reply With Quote