how to calculate the 2 days or 3 days total amounts in MySQL.
a sum of 3 days amounts and sum of 2 days amounts
how to write a query in MySql
I don't know how your relation looks like but if I get it right you want to SUM
one column over the past 2 or 3 days which will be something like:
SELECT FORMAT(SUM(yourColumnName)
FROM tableName
WHERE entry.date >= CURDATE() - INTERVAL 2 days
For 3 days you have to set INTERVAL 3 days
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.