Chapter 8 · Window Functions
48. Running Total of Billing Amounts
Hard40 XPHealthcare
Calculate a running total of billing amounts ordered by billed_at date. Return the billing id, billed_at, amount, and the cumulative total up to and including that row.
Tables
- PKidINT
- FKvisit_id→ visits.idINT
- amountREAL
- insurance_coveredREAL
- patient_responsibilityREAL
- statusTEXT
- billed_atTEXT
- paid_atTEXT
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.