Get all items - excluding items from another set

Scenario:

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 = 
  SELECT t 
  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
2 Likes

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?