Home
Public posts
API
Home
Public posts
API
Sign in with GitHub
Untitled.txt
Java
Share
My Codes
Sign in
1
SELECT o.id, o.total_sum, SUM(oi.quantity * oi.price) AS actual_sum
2
FROM orders o
3
JOIN order_items oi ON o.id = oi.order_id
4
GROUP BY o.id, o.total_sum
5
HAVING o.total_sum <> SUM(oi.quantity * oi.price);