SELECT tp.method payment_method,COUNT(DISTINCT c.id) customers,COUNT(t.id) transactions,AVG(t.final_total) avg_transaction FROM contacts c JOIN transactions t ON c.id=t.contact_id JOIN transaction_payments tp ON t.id=tp.transaction_id WHERE t.type="sell" GROUP BY tp.method ORDER BY transactions DESC;