Return plan, paid_invoice_count, and paid_amount for invoices with at least one succeeded attempt. Count each invoice once using its invoice amount, grouped by plan and ordered by plan.
The database is already loaded with the schema and seed data. You are given paid_invoices.sql (a query that runs but returns the wrong answer). Fix paid_invoices.sql so it returns the correct result.