在MySQL中,我有两个持续时间:15:12和19:24,我想选择它们的总和。这将超过24:00。它似乎不起作用?
答案 0 :(得分:0)
您可以使用ADDTIME
获取这两个时间值的SELECT ADDTIME('15:12', '19:24') -- 34:36:00
:
SUM
要SELECT
CONCAT_WS(':',
SUBSTRING(CAST(SEC_TO_TIME(SUM(TIME_TO_SEC(x.t_value))) + 0 AS CHAR), 1, LENGTH(CAST(SEC_TO_TIME(SUM(TIME_TO_SEC(x.t_value))) + 0 AS CHAR)) - 4),
SUBSTRING(CAST(SEC_TO_TIME(SUM(TIME_TO_SEC(x.t_value))) + 0 AS CHAR), -4, 2),
SUBSTRING(CAST(SEC_TO_TIME(SUM(TIME_TO_SEC(x.t_value))) + 0 AS CHAR), -2, 2)
)
FROM (
SELECT '15:12' AS t_value UNION ALL
SELECT '19:24' AS t_value UNION ALL
SELECT '2:00' AS t_value
)x
-- 36:36:00
多个时间值,您可以使用以下解决方案:
if (Input.GetButton("Jump") || SwipeManager.IsSwipingUp())
moveDirection.y = jumpSpeed;