我正在从特定lastModified
属性后的jcr中检索节点集。
但对于某些节点,它没有lastModified
属性,在这种情况下,我的查询必须查找jcr:createdDate
。
它将如何实现?
这是我的查询
SELECT * FROM [nt:base] AS s WHERE [cq:lastModified] > CAST('2014-05-08T17:36:00.400+05:30' AS DATE)
由于
答案 0 :(得分:1)
我认为使用OR条件应该适用于您的情况,因为lastModified不大于指定日期的节点显然不会使createdDate大于它。
如果lastModified不存在,它将检查createdDate并相应地生成结果
SELECT * FROM [nt:base] AS s
WHERE [cq:lastModified] > CAST('2014-05-08T17:36:00.400+05:30' AS DATE)
OR [jcr:created] > CAST('2014-05-08T17:36:00.400+05:30' AS DATE)
答案 1 :(得分:1)
测试属性缺失looks like that:
[cq:lastModified] IS NULL
您的查询可以重写为:
SELECT *
FROM [nt:base] AS s
WHERE
[cq:lastModified] > CAST('2014-05-08T17:36:00.400+05:30' AS DATE)
OR ([cq:lastModified] IS NULL
AND
[jcr:created] > CAST('2014-05-08T17:36:00.400+05:30' AS DATE))