Chapter 6 · Subqueries
08. Payment Status by Method
Medium20 XPE-Commerce
The finance team wants a breakdown of payment statuses per payment method. For each payment method, return the method name, total number of payments, count of completed payments, and total amount of completed payments (rounded to 2 decimals). Sort by total payments descending.
Tables
- PKidINT
- FKorder_id→ orders.idINT
- payment_dateTEXT
- amountREAL
- methodTEXT
- statusTEXT
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.