mysql时间转换时获取null值

时间:2016-12-16 09:46:06

标签: mysql

下面提到的查询返回null但我的内部查询正在获取值 shown here

SELECT CONCAT(
FLOOR(HOUR(time_milis) / 24), ' ',
MOD(HOUR(time_milis), 24), ':',
MINUTE(time_milis),':',
SECOND(time_milis)) 
FROM (
  SELECT SUM(TIMEDIFF(logout_timestamp,login_timestamp)) AS time_milis FROM t_access_log WHERE logout_timestamp!='0000-00-00 00:00:00' GROUP BY login_id
)se

我在这里缺少什么

2 个答案:

答案 0 :(得分:1)

为什么不使用DATE_FORMAT()呢?所以我的猜测是这样的:

SELECT login_id , 
    DATE_FORMAT(
    SUM(
        TIMEDIFF(
            logout_timestamp,login_timestamp)
        )
    ) as some_time
FROM t_access_log
WHERE logout_timestamp!='0000-00-00 00:00:00'
GROUP BY login_id;

答案 1 :(得分:0)

您的 check process qifu with pidfile /var/www/qifu/tmp/pids/puma.pid start program = "/bin/bash -l -c 'cd /var/www/qifu && pumactl -F config/puma_production.rb start'" with timeout 60 seconds stop program = "/bin/bash -l -c 'cd /var/www/qifu && pumactl -F config/puma_production.rb stop'" if cpu > 60% for 2 cycles then alert if cpu > 80% for 5 cycles then restart if 3 restarts within 5 cycles then timeout 都是秒,但hour需要time_milis time,您可以使用sec_to_time。像这样:

'10:05:03'