![](/img/trans.png)
[英]Marklogic - Optic API: Joining views by value (op:on does not support values, only column-references)
[英]MarkLogic Optic API: Filtering rows with op:where() with timestamps older than 30 days
在我的數據集中,我有一個包含 xs:dateTime 時間戳的字段 testDateTime: 2022-06-02T10:42:00Z
使用光學 API 和op:where()
,有沒有辦法可以過濾我的結果以排除時間戳超過 30 天的任何行?
我一直在嘗試在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"))
有沒有辦法讓這個工作與 SQL 條件或光學操作員本身一起工作?
僅使用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.