[英]how to calculate the two days or 3 days total amounts in my sql
how to calculate the 2 days or 3 days total amounts in MySQL.如何计算 MySQL 中 2 天或 3 天的总金额。
a sum of 3 days amounts and sum of 2 days amounts 3 天金额的总和和 2 天金额的总和
how to write a query in MySql如何在 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:我不知道你的关系是什么样的,但如果我做对了,你想在过去的 2 或 3 天内SUM
一列,这将是这样的:
SELECT FORMAT(SUM(yourColumnName)
FROM tableName
WHERE entry.date >= CURDATE() - INTERVAL 2 days
For 3 days you have to set INTERVAL 3 days
对于 3 天,您必须将INTERVAL 3 days
设置为INTERVAL 3 days
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.