Mysql 如何从IF子句返回时间

Mysql 如何从IF子句返回时间,mysql,Mysql,我无法从条件选择输出时间。如果时间

我无法从条件选择输出时间。如果时间<6小时,目标是减去30分钟

下面是一个演示:

SELECT TIME(start_time) AS start,
    TIME(end_time) AS end,
    TIME_TO_SEC(TIMEDIFF(end_time, start_time)) AS durationSecs,
    IF(
        TIMEDIFF(end_time, start_time) >= "06:00:00",
        SUBTIME(TIMEDIFF(end_time, start_time), 30:0:0),
        TIMEDIFF(end_time, start_time)
    ) AS duration
FROM [...]
这段代码返回我认为是时间对象本身的字符串表示形式,例如30303a30353a3030

我怎样才能让它输出实际的时间

SELECT TIME(start_time) AS start,
    TIME(end_time) AS end,
    TIME_TO_SEC(TIMEDIFF(end_time, start_time)) AS durationSecs,
    IF(
        TIMEDIFF(end_time, start_time) >= "06:00:00",
        TIMEDIFF(end_time - INTERVAL 30 MINUTE, start_time),
        TIMEDIFF(end_time, start_time)
    ) AS duration
FROM [...]