Jamie
Jamie

Reputation: 477

How to SUM mysql rows

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

Upvotes: 0

Views: 80

Answers (1)

FrankieTheKneeMan
FrankieTheKneeMan

Reputation: 6800

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

It's that easy.

Upvotes: 2

Related Questions