title: Return multiple aggregate columns in LINQ
body: <p>I would like to translate the following SQL into LINQ:</p>
  
  <pre><code>SELECT
      (Select count(BidID)) as TotalBidNum,
      (Select sum(Amount)) as TotalBidVal
  FROM Bids
  </code></pre>
  
  <p>I've tried this:</p>
  
  <pre><code>from b in _dataContext.Bids
  select new { TotalBidVal = b.Sum(p =&gt; p.Amount), TotalBidNum = b.Count(p =&gt; p.BidId) }
  </code></pre>
  
  <p>but get an error "Bids does not contain a definition for "Sum" and no extension method "Sum" accepting a first argument of type "Bids" could be found.</p>
  
  <p>How can I do this in LINQ?</p>
  
  <p>Thanks</p>
  
  <p>CONCLUDING:</p>
  
  <p>The final answer was:</p>
  
  <pre><code>var ctx = _dataContext.Bids;
  
  var itemsBid = (from b in _dataContext.Bids
                 select new { TotalBidVal = ctx.Sum(p =&gt; p.Amount), TotalBidNum = ctx.Count() }).First();
  </code></pre>