I am trying to filter the documents based on this condition using Xquery optic lib in marklogic. But op:sql-condition doesn't seem to work as expected.
op:sql-condition("Employee.employeeName LIKE '%JOHN%' AND Employee.employeeName LIKE '%Smith%' AND Employee.employeeName LIKE '%Eric%'")
Using this condition I am hoping to get all the documents which has those employee names, but it only returns the first one from the condition. In this condition, it is JOHN.
How do I update this query to work with AND having multiple conditions?
According to the developer documentation:
and further:
So this means: no boolean operations inside the SQL expression but just a boolean result.
You can join multiple where conditions to achieve an "and" operation between them. I expanded the example from the documentation page a bit to show that:
This gives the entry with the ID 3 as a result, because it's ID is between 0.5 and 3.5 AND is greater than 2. You should be able to apply it to three individual like statements as well.