SELECT CASE WHEN tsl.unit_price_before_discount<=10 THEN "Low" WHEN tsl.unit_price_before_discount<=50 THEN "Medium" ELSE "High" END price_category,COUNT(t.id) transactions,SUM(tsl.quantity) units FROM transaction_sell_lines tsl JOIN transactions t ON tsl.transaction_id=t.id WHERE t.type="sell" GROUP BY 1 ORDER BY units DESC;