title: Using MIN function in LINQ
body: <p>I have a SQL Query of a view. This view </p>
  
  <pre><code>SELECT
    [ID]
    [Name],
    [Category],
    MIN(OrderDate) as OrderDate, 
    MIN(DeliveryDate) as DeliveryDate
  GROUP BY
    [ID], [Name], [Category]
  FROM
    [OrdersView]
  </code></pre>
  
  <p>I know this query is correct because my DBA gave it to me. But I need to convert it into LINQ. Currently, I have the following:</p>
  
  <pre><code>var orders = from o in dataContext.OrdersView
               group o by new { o.ID, o.Name, o.Category } into grouping
               select new Order() {
                 ID = grouping.Key.ID,
                 Name = grouping.Key.Name,
                 Category = grouping.Key.Category,
                 OrderDate = ?,
                 DeliveryDate = ?
               };
  </code></pre>
  
  <p>My problem is I do not know how to execute the MIN function on the OrderDate and DeliveryDate and use those values in my LINQ query. Unfortunately, I cannot change the database because its locked down. Can someone please point me in the right direction?</p>
  
  <p>Thanks!</p>