Search code examples
orientdb

What's the opposite of the intersect function in OrientDB?


I'm currently looking for the opposite of the function intersect

Let me explain with some queries :

  • the first one return a list of @rid

  • The seconde one retun a list of @rid

  • The third one return a list of @rid which are in the first and in the second one

-> I'm looking for the query that return a list of @rid which are in the first but not in the second

SELECT in("Regroupe").in("Obligatoire").out("Pertinent") FROM 89:50
-> #69:110 #62:19 #60:1 #59:38 #62:114

SELECT out("Pertinent") FROM 89:50
-> #69:110 #62:19 #60:1 

SELECT intersect(in("Regroupe").in("Obligatoire").out("Pertinent"), out("Pertinent")) FROM #89:50
-> #62:19 #60:1 #69:110

I'm looking for this query :

SELECT except/difference(in("Regroupe").in("Obligatoire").out("Pertinent"), out("Pertinent")) FROM #89:50
-> #59:38 #62:114

Solution

  • Ok i find what was missing !

    I have to compare on @rid :

    SELECT difference(in("Regroupe").in("Obligatoire").out("Pertinent").@rid, out("Pertinent").@rid) FROM #89:50