1

I have requirement to do minus in one of the use case but in MarkLogic I am not able to use minus function. Is there any alternate way to do this?

select table1.value1 from table1 where table1.date = '2020-11-27'
minus
select table1.value1 from table1 where table1.date = '2020-11-26'
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
ramz123
  • 207
  • 1
  • 8

2 Answers2

2

The "MINUS" operator is a SPARQL operator. Similar functionality is supported in MarkLogic's Optic API using the op:except() operator. You can also use the "MINUS" operator in SPARQL and op:from-sparql() in the Optic API, and the "EXCEPT" operator in SQL and op:from-sql() in the Optic API.

Mads Hansen
  • 63,927
  • 12
  • 112
  • 147
John Snelson
  • 941
  • 4
  • 4
-1

The minus/subtraction operator in XQuery is "-", like in most languages. The rest of your code looks a bit like SQL to me (though I last used SQL about 30 years ago) and it will all need changing.

I don't now what "Optic Query" is, I'm afraid.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Michael Kay
  • 156,231
  • 11
  • 92
  • 164