title: Selecting Orders with multiple line items but not when one or more line items contains a defined list
body: <p>I am having trouble with a SQL Server query. I have a couple of tables involved <code>[Order]</code> (I know, not named well) and <code>[Order Entry]</code>. </p>
  
  <p>Order Entry is basically a "Line Item" on an Order (so there are one or more per Order). There are various columns in Order Entry, one of which is <code>ItemID</code> (there is only one <code>ItemID</code> per Order Entry). I want a query that returns all rows (Orders) that don't contain one or more Order Entry's with a list of ItemID's defined in a list.</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>SELECT DISTINCT 
      oe.OrderID, StoreID
  FROM 
      OrderEntry oe
  INNER JOIN  
      [order] o ON o.ID = oe.OrderID 
                AND o.StoreID = oe.StoreID
                AND oe.ItemID NOT IN (60, 856, 857, 858, 902, 59, 240, 57, 217, 853, 855, 854, 41)
  </code></pre>
  
  <p>What I want to do seem similar to this (below) but I can't figure it out:
  <a href="https://stackoverflow.com/questions/14052456/select-all-orders-with-more-than-one-item-and-check-all-items-status">SELECT all orders with more than one item and check all items status</a></p>
  
  <p>Help please! (much appreciated)</p>