怎样对MYSQL中的两列时间做减法?

怎样对MYSQL中的两列时间做减法?,第1张

--这样是显示的结果是差值总的秒数

select sum(unix_timestamp(B)-unix_timestamp(A)) as 秒数

from tb

--这样是显示成 xxx:xx:xx 的形式

select sec_to_time(sum(unix_timestamp(B)-unix_timestamp(A))) as ti

from tb

--

select count(*) from handup where unix_timestamp(hinserttime) >(select unix_timestamp(max(hinserttime)) from handup) - 3600


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5901969.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-07
下一篇 2023-03-07

发表评论

登录后才能评论

评论列表(0条)

保存