title: Performing complex query with Dynamics CRM 4.0
body: <p>I have two custom entites, Product and ProductType, linked together in many-to-one relationship.  Product has a lookup field to ProductType.</p>
  
  <p>I'm trying to write a query to fetch Type1 products with a price over 100, and Type2 products with a price lower than 100.</p>
  
  <p>Here's how I would do it in SQL :</p>
  
  <pre><code>select *
    from Product P
   inner join ProductType T on T.Id = P.TypeId
   where (T.Code = 'Type1' and P.Price &gt;= 100)
      or (T.Code = 'Type2' and P.Price &lt; 100)
  </code></pre>
  
  <p>I can't figure out a way to build a QueryExpression to do exactly that.  I know I could do it with two queries, but I'd like to minimize roundtrips to the server.</p>
  
  <p>Is there a way to perform that query in only one operation ?</p>
  
  <p>Thanks!</p>