[英]MarkLogic Optic API: Filtering rows with op:where() with timestamps older than 30 days
In my dataset I have a field testDateTime that contains xs:dateTime timestamps: 2022-06-02T10:42:00Z
在我的数据集中,我有一个包含 xs:dateTime 时间戳的字段 testDateTime: 2022-06-02T10:42:00Z
Using the optic API and op:where()
, is there a way I can filter my results to exclude any rows with timestamps older than 30 days?使用光学 API 和op:where()
,有没有办法可以过滤我的结果以排除时间戳超过 30 天的任何行?
I have been attempting to use the following SQL statements in op:like-sql-condition()
but do not look to be supported:我一直在尝试在op:like-sql-condition()
中使用以下 SQL 语句,但看起来不受支持:
=>op:where(op:sql-condition("MyData.testDateTime < CURRENT_DATE - 30"))
=>op:where(op:sql-condition("MyData.testDateTime < DATEADD(day, -30, GETDATE())"))
=>op:where(op:sql-condition("MyData.testDateTime < NOW() - INTERVAL 30 DAY"))
=>op:where(op:sql-condition("MyData.testDateTime < GETDATE() - 30"))
Is there a way to get this working either with a SQL condition or with optic operators themselves?有没有办法让这个工作与 SQL 条件或光学操作员本身一起工作?
What about just using op:lt()
and testing whether the testDateTime
column is less than currentDateTime() - xs:dayTimeDuration("P30D")
:仅使用op:lt()
并测试testDateTime
列是否小于currentDateTime() - xs:dayTimeDuration("P30D")
:
=> op:where(op:lt(op:col("MyData.testDateTime"), current-dateTime() - xs:dayTimeDuration("P30D")))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.