I was looking for a simliar solution. I need a full row with a mini value for a table group by another column. Here is the solution I came across. I sorted the table using the minium column with the order_by clause and submitted a subquery to the query with ORDER BY, which catches the first row that appears, which is a sorted row.
id bigint(20) commission decimal(5,4) door_price decimal(19,2) event_id bigint(20) min_commission decimal(19,2) price decimal(19,2) visible_to_public SELECT * FROM (SELECT price_bundle.id as id, event_id, price_bundle.price + (case when ((price_bundle.commission * price_bundle.price) > price_bundle.min_commission) then (price_bundle.commission * price_bundle.price) else price_bundle.min_commission end) AS total FROM price_bundle WHERE price_bundle.visible_to_public = 1 ORDER BY total asc ) AS price_bundle_order_by_total_price_asc GROUP BY event_id
Sergio del amo
source share