0
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.

enter image description here

1 Answer 1

1
SELECT SUM(`contract_fine`) AS TotalFine FROM `contract` 
NATURAL JOIN `rented_vehicle` WHERE `contractID` = 3;

It's that easy.

Sign up to request clarification or add additional context in comments.

4 Comments

@JamieStraw You really were!
Was trying loads of combinations with the SUM, turns out I missed the brackets in my attempts.
Ah. Well, it is a function, after all.
Indeed, easy fix, will remember for the future, thanks again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.