title: LINQ or lambda expression with subquery and NOT IN logic
body: <p>I'm trying to wrap my head around the proper syntax for a LINQ query <strong>or</strong> a lambda expression that returns the equivalent to the following SQL query:</p>
  
  <pre><code>SELECT * 
  FROM tool t 
  WHERE t.UniqTool 
    NOT IN (SELECT t1.uniqtool  
            FROM tool t1
            INNER JOIN [version] v ON v.UniqTool = t1.UniqTool 
              AND v.IsBetaVersion = 1)
  </code></pre>
  
  <p>Basically, I want to get the list of tools that don't already have a beta version. I have a tool object that has both the UniqTool (ID value) and a boolean property indicating whether that version is beta.</p>
  
  <p>Here was my initial attempt:</p>
  
  <pre><code>var tools = from t in session.CachedTools where !t.IsBetaVersion select t;
  </code></pre>
  
  <p>I realized it gave me the wrong result set and I got lost trying to figure out the subquery with NOT IN logic.</p>
  
  <p>Thanks!</p>