Invoice Total Mismatch
Medium
Data Quality Checks
An invoice's stated total should equal the sum of its lines. Return invoices where it does not, with both values. Order by invoice id.
Table schema
Invoices(id INT PRIMARY KEY, total INT)
InvoiceLines(invoice_id INT, amount INT)Sample data
Invoices
id | total
1 | 100
2 | 250
3 | 80
InvoiceLines
invoice_id | amount
1 | 60
1 | 40
2 | 200
2 | 30
3 | 80
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.