0

这是 OrientDb 2.1.4。

以下查询工作正常:

从 SyncableHist 中选择,其中 history_date <= date('2016-04-12 21:25:17','yyyy-MM-dd HH:mm:ss')

并按预期返回三条记录,每条记录的值为 history_date = '2016-04-12 21:25:17'。history_date 是 DATETIME 类型。

但是,这不会返回任何记录:

从 SyncableHist 中选择,其中 history_date = date('2016-04-12 21:25:17','yyyy-MM-dd HH:mm:ss')

有任何想法吗???

谢谢!

4

1 回答 1

1

在比较之前将您的日期格式化为字符串。不知道为什么,但可能有一些额外的东西,比如毫秒,或者您的数据库无法以这种方式进行比较。

select from SyncableHist where history_date.format('yyyy-MM-dd HH:mm:ss') = '2016-04-12 21:25:17'

于 2016-05-03T21:35:53.737 回答