基本上我想将存储的数字相加field1
,field2
并且field3
只显示该总数小于field4
...的记录
例如:select * from table where field1 + field2 + field3 <= field 4
但这不起作用....任何帮助表示赞赏
这是我的实际 SQL,您可以看到它更复杂:
SELECT
*,
SUM ( amountpaid , amountpaid2 , amountpaid3 ) AS total AND
DATE_FORMAT(date_start, ' %d.%m.%Y') AS date_formatted
FROM
calendar_event
WHERE
Date_start BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 14 DAY) AND
total <= amount )
抢