How to write query in sql2 for matching properties of parent node and child nodes simultaneously.
I have a scenario where I have to match 2-3 properties of parent node and 2 properties of some child node under that parent node simultaneously. I am unable to achieve that only one condition runs at one time.
SELECT * FROM [nt:unstructured] AS parent WHERE ISDESCENDANTNODE(parent,[/etc/employees/employeedata]) AND parent.[bondStartDate] < CAST('2016-02-01T00:00:00.000+05:30' AS DATE) and parent.[bondEndDate] > CAST('2016-02-01T00:00:00.000+05:30' AS DATE) AND parent.[depts] = "purchase".The structure of the Node is like :
etc/employees/employeedata
-- employee1 (bondStartDate, bondEndDate, DOJ, Designation etc properties)
-- bonddetails
-- 0 (depts, tenure etc properties)
--- 1 (depts, tenure etc properties)
Now if I run
SELECT * FROM [nt:unstructured] AS parent WHERE ISDESCENDANTNODE(parent,[/etc/employees/employeedata]) AND parent.[bondStartDate] < CAST('2016-02-01T00:00:00.000+05:30' AS DATE) and parent.[bondEndDate] > CAST('2016-02-01T00:00:00.000+05:30' AS DATE) it gives me the node
etc/employees/employeedata/employee1
If I run below :
SELECT * FROM [nt:unstructured] AS parent WHERE ISDESCENDANTNODE(parent,[/etc/employees/employeedata]) AND parent.[depts] = "purchase"it returns etc/employees/employeedata/employee1/bonddetails/0
But I want to match both the criteria simultaneously and return the parent node i.e. etc/employees/employeedata/employee1 or etc/employees/employeedata/employee1/bonddetails/0 whatever is possible.