SELECT DATE(t.transaction_date) date,COUNT(DISTINCT c.id) unique_customers,COUNT(t.id) transactions,AVG(t.final_total) avg_transaction FROM contacts c JOIN transactions t ON c.id=t.contact_id WHERE t.type="sell" GROUP BY DATE(t.transaction_date) ORDER BY date;