Loading the editor…
Find bills whose payment date is later than the due date.
The vendor scorecard flags late payments. Open bills are not late payments yet, because they have not been paid.
Return bill_id, vendor_name, due_on, and paid_on. vendor_name is trimmed. Keep bills where paid_on is after due_on. Sort by paid_on, then bill_id.
| id | name | account_type |
|---|---|---|
| 1 | Cash | asset |
| 2 | Accounts Payable | liability |
| 3 | Sales Revenue | revenue |
| id | name | category |
|---|---|---|
| 1 | Harbor Office | Facilities |
| 2 | Northwind Cloud | Software |
| 3 | City Clinic Supplies | Medical |
| id | vendor_id | amount_cents | issued_on | due_on | paid_on | status |
|---|---|---|---|---|---|---|
| 1 | 1 | 180000 | 2025-01-02 | 2025-01-31 | 2025-01-20 | paid |
| 2 | 2 | 42000 | 2025-01-05 | 2025-02-04 | 2025-02-10 | paid |
| 3 | 2 | 42000 | 2025-02-05 | 2025-03-07 | NULL | open |
| id | account_id | txn_date | amount_cents | direction | memo | status |
|---|---|---|---|---|---|---|
| 1 | 4 | 2025-01-20 | 180000 | debit | January rent | posted |
| 2 | 5 | 2025-02-10 | 42000 | debit | Cloud january | Posted |
| 3 | 6 | 2025-01-28 | 250000 | debit | Payroll | POSTED |
Ctrl or Cmd + Enter runs the query. The database resets on every run.
Run the query to see rows from the sample database.
Next exercise: Diagnosis codes used more than once
Related: Bill aging labels, Open payables by vendor