Reputation: 477
SELECT `contract_fine` AS TotalFine FROM `contract`
NATURAL JOIN `rented_vehicle` WHERE `contractID` = 3;
This returns rows of numbers, how would I go about adding them together, I can't seem to do it.
Upvotes: 0
Views: 80
Reputation: 6800
SELECT SUM(`contract_fine`) AS TotalFine FROM `contract`
NATURAL JOIN `rented_vehicle` WHERE `contractID` = 3;
It's that easy.
Upvotes: 2