title: SQL Server : Extract/Compare Query 1 from Query 2
body: <p>This first query is written that looks for the tickets that are assigned to our staff for a specific group set to a specific status.</p>
  
  <pre><code>  SELECT DISTINCT [SENT TO]
    FROM [sdetst].[_SMDBA_].[_TELMASTE_]
    WHERE [_GROUP_] = 1003 and [SEQ_UDSTATUS:] = 1002 and [SENT TO] is not null 
  </code></pre>
  
  <p>This second query is written to locate the staff that are currently online and available.</p>
  
  <pre><code>  SELECT DISTINCT DESK._ACTIVEUSERS_.[Seq.User] 
    FROM DESK.[Support Staff] INNER JOIN DESK._ACTIVEUSERS_ 
    ON DESK.[Support Staff].Sequence = DESK._ACTIVEUSERS_.[Seq.User] 
  </code></pre>
  
  <p>What I am trying to do is get the results in query 1 that are not in query 2. Then after I have gotten this I plan to set those values to null as it would make the tickets unassigned and could be handled by other staff. I intend to set this as a scheduled job that will run every few minutes.</p>