Finance wants to compare payment methods. For each payment_type, report the total sales value and the number of distinct customers who paid with that type. A customer who used a payment type several times counts once for that type. Write an SQL query that returns payment_type, total_sales and unique_customers. Order the results by total_sales descending, then payment_type ascending.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.