SELECT bl.name location,COUNT(t.id) transactions,AVG(TIMESTAMPDIFF(MINUTE,t.created_at,t.updated_at)) service_time,SUM(t.final_total)/COUNT(t.id) cost_per_transaction FROM business_locations bl JOIN transactions t ON bl.id=t.location_id WHERE t.type="sell" GROUP BY bl.id,bl.name ORDER BY service_time;