Stripe's account managers want to reach out to large merchants that are slowing down. First, rank merchants by total payment volume (sum of amount) from 2025-01-01 through 2025-03-31 and take the top 4. Then keep only those whose number of transactions in March 2025 is lower than in February 2025. A merchant with no March transactions has a March count of 0. Transactions outside Q1 2025 are ignored for both steps. Write an SQL query that returns merchant_id, merchant_name, total_volume, feb_txns and mar_txns. Order the results by total_volume descending.
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.