SELECT bl.name location,bl.state,bl.city,COUNT(t.id) transactions,SUM(t.final_total) revenue,SUM(t.final_total)/(SELECT SUM(final_total) FROM transactions WHERE type="sell")*100 market_share FROM business_locations bl JOIN transactions t ON bl.id=t.location_id WHERE t.type="sell" GROUP BY bl.id,bl.name,bl.state,bl.city ORDER BY market_share DESC;