gpt4 book ai didi

mysql - 为什么Mysql时间输出值显示为hhmmss而不是hh :mm:ss?

转载 作者:行者123 更新时间:2023-11-29 21:03:28 24 4
gpt4 key购买 nike

我正在使用以下查询,除了“时间”列之外,该查询运行良好。我的输出为 hhmmss,但我想要 hh:mm:ss

select Agent_ID, date(Start_Time),
SUM(CASE WHEN Break_Reason = 'teabreak' THEN login.Time ELSE NULL END) TeaBreak
from login
where Agent_ID = '3331'
and date(start_time) = '2016-04-02';

如何解决?

最佳答案

看一下 date_format(日期, 格式):

select Agent_ID, date_format(date(Start_Time),'%H:%i:%S'),
SUM(CASE WHEN Break_Reason = 'teabreak' THEN login.Time ELSE NULL END) TeaBreak
from login
where Agent_ID = '3331'
and date(start_time) = '2016-04-02';

有关更多信息,请查看:http://www.w3schools.com/sql/func_date_format.asp

关于mysql - 为什么Mysql时间输出值显示为hhmmss而不是hh :mm:ss?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37021508/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com