1
votes

I would like to know how do perform NOT IN operation in marklogic they way we perform against rdbms

select * from Employee where id not in (1,2,3,4,5,6)

I tried cts:not-in-query but it takes single instance of single positive & negative queries, how do I pass multiple values like not in (1,2,3,4,5,6)

1

1 Answers

6
votes

If you have a range index on id (assuming it is an element), you could do:

cts:element-range-query(xs:QName('id'), '!=', (1,2,3,4,5,6))

Otherwise you could try:

cts:not-query(cts:element-value-query(xs:QName('id'), (1,2,3,4,5,6)))

HTH!