两分钟时间戳的总和

时间:2020-12-07 01:38:23

I've searched through many sites but was unable to find a solution to this. I'm trying to sum two timestampdiffs when they are in minutes:

我搜索了很多网站,但无法找到解决方案。我想在几分钟内总结两个时间戳:

SELECT COUNT(*) from `table` 
WHERE
TIMESTAMPADD(MINUTE,
    TIMESTAMPDIFF(MINUTE,first_date,second_date),
    TIMESTAMPDIFF(MINUTE,fourth_date,third_date)
) > 15 AND status='Pending'

This is where I am currently at but it returns an empty result.

这是我目前所处的位置,但它返回一个空结果。

Can anyone enlighten me with an answer to this? Thank you.

有人可以给我一个答案吗?谢谢。

I've tried this as well but to no avail

我也试过这个,但无济于事

SELECT COUNT(*) from `table` 
WHERE 
AddTime(TIMESTAMPDIFF(MINUTE,first_date,second_date),
        TIMESTAMPDIFF(MINUTE,fourth_date,third_date)
    ) > 15 AND status='Pending'

and also this one

还有这一个

SELECT COUNT(*) from `table` 
    WHERE 
    (TIMESTAMPDIFF(MINUTE,first_date,second_date)+TIMESTAMPDIFF(MINUTE,fourth_date,third_date))
        ) > 15 AND status='Pending'

1 个解决方案

#1


In your query, you are adding minute to minute, you can add minute to a date if you want to use TIMESTAMPADD function

在您的查询中,您要添加分钟,如果要使用TIMESTAMPADD函数,可以将分钟添加到日期

Try this one

试试这个吧

SELECT *
from table
WHERE TIMESTAMPDIFF(MINUTE,first_date,second_date) + TIMESTAMPDIFF(MINUTE,fourth_date,third_date) > 120

#1


In your query, you are adding minute to minute, you can add minute to a date if you want to use TIMESTAMPADD function

在您的查询中,您要添加分钟,如果要使用TIMESTAMPADD函数,可以将分钟添加到日期

Try this one

试试这个吧

SELECT *
from table
WHERE TIMESTAMPDIFF(MINUTE,first_date,second_date) + TIMESTAMPDIFF(MINUTE,fourth_date,third_date) > 120