How to get sum of two column values from SQL table using Entity Framework?
<p><a href="https://i.stack.imgur.com/Cifgg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cifgg.jpg" alt="enter image description here"></a></p>

<p>I have a table name <code>GRNDtlReturn</code> in above mention screenshot. I want to get the sum of <code>ReturnQuantity</code> of first and third rows in table. I have written some code, but it returns the sum of full <code>ReturnQuantity</code> column. Please help me to solve this. </p>

<p>Here's my code:</p>

<pre><code>public IList&lt;GRNDtlReturnModel&gt; GetReturnSum()
{
    return igrndtlreturnRepository.GetList (x=&gt; x.GRNNo == "GRN00022"  &amp;&amp; x.ProductCode == "D/F/HL/DM/0003/C/002")
            .Select(y =&gt; new GRNDtlReturnModel
            {
                GRNNo = y.GRNNo,
                totalQuantity = context.GRNDtlReturns.Sum(p =&gt; p.ReturnQuantity)
            }).ToList();
} 
</code></pre>