Get all items - excluding items from another set


A = all items.
B = a subset of A
C: Select all items from A NOT in B

and here’s my query:

CREATE QUERY GetConceptVoters_Available(vertex<Concept> inputConcept) FOR GRAPH wtapp syntax v2 {
  Start = {inputConcept};
  StartAllVoters = {Voter.*};
  listA = SELECT s From StartAllVoters:s; 

  listB = SELECT t FROM Start:s-(Concept_Has_Voter>:e)-Voter:t;
  listC = 
  FROM listA:t 
  WHERE t != listB;  
  PRINT listC;

Error: An undefined variable assigned in current scope

(referring to: "WHERE t != assigned;")

How do I compare the results from the two select statements to get “list C”?

Thank you.

Hi George,

I do not have time to test it, but I think using the MINUS operator would solve your problem.
Something like this:

listC = listA MINUS listB
1 Like

Wow, I didn’t see that one coming. It works, I like it, and its much simpler than a complicate From/Where clause.

Thanks and great work to the guys who created this.

Is it possible to add an ORDER BY to listC?