Not able to check "jcr:lastModified" for Multiple Paths | SQL 2 Query | Community
Skip to main content
krish747
Level 2
Mar 4, 2019 4:24 AM UTC
Solved

Not able to check "jcr:lastModified" for Multiple Paths | SQL 2 Query

Hi,

I am trying to get pages under the Multiple paths between  last modified date range (fromDate and toDate) . The results are coming but its wrong when checked with "jcr:lastModified". Also it is returning results for the pages where jcr:lastModified property is not exists.

SELECT * FROM [cq:PageContent] AS s WHERE ISDESCENDANTNODE([/content/we-retail/us/en/experience]) OR ISDESCENDANTNODE([/content/we-retail/us/en/men]) and [jcr:lastModified] >= '2016-01-01T00:00' and [jcr:lastModified] <= '2019-10-10T00:00'

The same query when tried with Single path, it is working fine. Could someone please tell me why the query is not working fine when more than paths are given?

SELECT * FROM [cq:PageContent] AS s WHERE ISDESCENDANTNODE([/content/we-retail/us/en/experience]) and [jcr:lastModified] >= '2016-10-01T00:00' and [jcr:lastModified] <= '2019-10-10T00:00'

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
krish747
krish747Accepted solution
Level 2
Mar 5, 2019 3:09 AM UTC

Hi Gaurav,

Thanks for your timely help!   Your query is working as expected post removing 2 extra brackets (which was throws parse exception).

SELECT * FROM [cq:PageContent] AS s WHERE (ISDESCENDANTNODE([/content/we-retail/us/en/experience]) and [jcr:lastModified] >= '2016-01-01T00:00' and [jcr:lastModified] <= '2019-10-10T00:00')

OR

(ISDESCENDANTNODE([/content/we-retail/us/en/men]) and [jcr:lastModified] >= '2016-01-01T00:00' and [jcr:lastModified] <= '2019-10-10T00:00')

2 replies

krish747
krish747AuthorAccepted solution
Level 2
Mar 5, 2019 3:09 AM UTC

Hi Gaurav,

Thanks for your timely help!   Your query is working as expected post removing 2 extra brackets (which was throws parse exception).

SELECT * FROM [cq:PageContent] AS s WHERE (ISDESCENDANTNODE([/content/we-retail/us/en/experience]) and [jcr:lastModified] >= '2016-01-01T00:00' and [jcr:lastModified] <= '2019-10-10T00:00')

OR

(ISDESCENDANTNODE([/content/we-retail/us/en/men]) and [jcr:lastModified] >= '2016-01-01T00:00' and [jcr:lastModified] <= '2019-10-10T00:00')

Translate
Gaurav-Behl
Level 10
Mar 4, 2019 11:31 AM UTC

The brackets should be in appropriate position just like in a normal SQL query. Try this

SELECT * FROM [cq:PageContent] AS s WHERE

(ISDESCENDANTNODE([/content/we-retail/us/en/experience]) and [jcr:lastModified] >= '2016-01-01T00:00' and [jcr:lastModified] <= '2019-10-10T00:00'))

OR

(ISDESCENDANTNODE([/content/we-retail/us/en/men]) and [jcr:lastModified] >= '2016-01-01T00:00' and [jcr:lastModified] <= '2019-10-10T00:00'))

Translate