LINQ query with multiple conditions in WHERE clause
<p>I am 6 months into my first development role and have started to use more LINQ in our repository layer to query our DB. I could really use some help with two queries I created.</p>

<pre><code>IQueryable&lt;long&gt; clientsWithoutFeature = from cf in db.Features
                where cf.Feature != 9 &amp;&amp; cf.Feature == 8
                select cf.Client;

IQueryable&lt;long&gt; clientsWithFeature = from cf in db.Features
                where cf.Feature == 9 &amp;&amp; cf.Feature == 8
                select cf.Client;
</code></pre>

<p>Each client can have multiple Feature's, each one being a separate record/row.</p>

<p>The first query is supposed to return all clients that have a Feature of 8 but not a Feature of 9. However, it is returning all clients with a Feature of 8 whether or not the client also has a Feature of 9.</p>

<p>The second query is supposed to return all clients that have a Feature of 8 and also have a Feature of 9. However, it is not returning any clients.</p>

<p>Can someone please tell me what is wrong with my queries?</p>