Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Invoice Total Mismatch

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.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.