SELECT bl.name location,COUNT(t.id) transactions,AVG(TIMESTAMPDIFF(MINUTE,t.created_at,t.updated_at)) processing_time,COUNT(t.id)/COUNT(DISTINCT t.created_by) transactions_per_staff 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 processing_time;