SELECT `contract_fine` AS TotalFine FROM `contract`
NATURAL JOIN `rented_vehicle` WHERE `contractID` = 3;
这会返回数字行,我如何将它们添加到一起,我似乎无法做到。
答案 0 :(得分:2)
SELECT SUM(`contract_fine`) AS TotalFine FROM `contract`
NATURAL JOIN `rented_vehicle` WHERE `contractID` = 3;
就这么简单。