gpt4 book ai didi

sqlite - 如何在Sqlite数据库中使用Group w.i.t.h.日期栏?

转载 作者:行者123 更新时间:2023-12-03 19:36:01 25 4
gpt4 key购买 nike

我的SQLite表中下面是coloumn:
ActivityDate的DataType是Sqlite提供的date

ActivityDate
2016-01-28 07:38:41 +0000
2016-01-28 03:26:56 +0000
2016-01-29 02:22:40 +0000
2016-01-26 01:13:39 +0000


我想获得唯一的日期(只有日期),我不想在此考虑时间。
所以我想要的结果是:

ActivityDate
2016-01-28 07:38:41 +0000
2016-01-29 02:22:40 +0000
2016-01-26 01:13:39 +0000


那么,有什么方法可以使用SQLite Query来实现?

最佳答案

这不是supported date formats之一。

为了能够使用内置的日期功能,您必须先截断时区:

SELECT date(substr(ActivityDate, 1, 19))
FROM transaction
GROUP BY date(substr(ActivityDate, 1, 19));

关于sqlite - 如何在Sqlite数据库中使用Group w.i.t.h.日期栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35099734/

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