title: LinQ max Date in one Query Optimized
body: <p>I have the following code:</p>
  
  <pre><code>Decimal initialBalance;
  DateTime dailyDate = ctx.DailyBalances.Max(c =&gt; c.DailyDate);
            if (dailyDate != null)
                initialBalance = ctx.DailyBalances.Where(c =&gt; c.DailyDate == dailyDate).Select(c =&gt; c.FinalBalance).FirstOrDefault();
              else
                  initialBalance = 0;
  
              return initialBalance;
  </code></pre>
  
  <p>Nevertheless i've been trying to get ways to optimized it,making one query instead of one... any sugestion??</p>