title: Convert SQL - LINQ - Problem with using both Min/Max
body: <p>Is there a online system which converts SQL - LINQ or can anyone else help convert the SQL - LINQ below?</p>
  
  <pre><code>SELECT MIN(startTime) As startTime, MAX(endTime) As endTime
  FROM tblRA
  LEFT JOIN tblA ON tblRA.asID = tblA.asID
  WHERE 'xxxxxx' BETWEEN tblRA.startDate AND tblRA.endDate
  AND tblA.availabilityDayOfWeek = 7
  </code></pre>
  
  <p>The main area I am having trouble is the .MAX/.MIN.</p>
  
  <p>Heres what I have so far</p>
  
  <pre><code>    public List&lt;string&gt; GetResourceAvailabilitiesByDate(DateTime searchDate)
      {
          DayOfWeek dayOfWeek = searchDate.DayOfWeek;
  
          var minVal = from a in dc.tblResourceAvailabilities
                  join b in dc.tblAvailabilities on a.asID equals b.asID 
                  where searchDate.Date &gt;= a.startDate.Date &amp;&amp; searchDate.Date &lt;= a.endDate.Value.Date
                  &amp;&amp; b.availabilityDayOfWeek == (int)dayOfWeek
                  select b.startTime.ToShortTimeString();;
  
          var maxVal = from a in dc.tblResourceAvailabilities
                       join b in dc.tblAvailabilities on a.asID equals b.asID
                       where searchDate.Date &gt;= a.startDate.Date &amp;&amp; searchDate.Date &lt;= a.endDate.Value.Date
                       &amp;&amp; b.availabilityDayOfWeek == (int)dayOfWeek
                       select b.endTime.ToShortTimeString();
  
          var min = minVal.Min(minVal.Min);
          var max = maxVal.Max();
  
          return min,max;
  </code></pre>
  
  <p>Thanks in advance for any help</p>
  
  <p>Clare</p>