gpt4 book ai didi

Mysql查询结果日期时间明智

转载 作者:行者123 更新时间:2023-11-29 00:06:19 25 4
gpt4 key购买 nike

我试过这样这是我的查询

SELECT sloat_day, sloat_start_time 
FROM time_table
WHERE sloat_day BETWEEN '2014-12-01' AND '2014-12-07'
ORDER BY sloat_day, sloat_start_time ASC

我的输出低于

sloat_day   sloat_start_time
2014-12-01 6.30
2014-12-01 7.30
2014-12-01 18.30
2014-12-01 19.30
2014-12-02 6.30
2014-12-02 7.30
2014-12-02 18.30
2014-12-02 19.30
2014-12-03 6.30
2014-12-03 7.30
2014-12-03 18.30
2014-12-03 19.30
2014-12-04 18.30
2014-12-04 19.30
2014-12-05 7.30
2014-12-05 18.30
2014-12-05 19.30
2014-12-06 19.30
2014-12-07 7.30
2014-12-07 8.30
2014-12-07 18.30
2014-12-07 19.30

我想要如下所示的查询结果,我想在查询中更改以获取此输出,请帮助我

2014-12-01  6.30
2014-12-02 6.30
2014-12-03 6.30
2014-12-04 18.30
2014-12-05 7.30
2014-12-06 19.30
2014-12-07 7.30
2014-12-01 7.30
2014-12-02 7.30
2014-12-03 7.30
2014-12-04 19.30
2014-12-05 18.30
2014-12-07 8.30
2014-12-01 18.30
2014-12-02 18.30
2014-12-03 18.30
2014-12-05 19.30
2014-12-07 18.30

最佳答案

像这样更改 ORDER 子句中列的顺序。

SELECT sloat_day, sloat_start_time 
FROM time_table
WHERE sloat_day BETWEEN '2014-12-01' AND '2014-12-07'
ORDER BY sloat_start_time, sloat_day ASC

这样,查询将首先按 sloat_start_time 排序。

关于Mysql查询结果日期时间明智,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27313179/

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