title: SQL query into LINQ in asp.net mvc
body: <p>Please anyone can help me to write this sql query into Linq. i have tried..</p>
  
  <p>this is my sql query</p>
  
  <pre><code>select  o.OrderID,o.Nature,o.Date,od.TotalPrice,os.OrderStatus,lo.FirstName,lo.EmailAddress,lo.PhoneNumber
  from [dbo].[Order] o
      inner join [dbo].[tbl_OrderDetails] od on  od.OrderID = o.OrderID
      inner join [dbo].[tbl_OrderHistory] oh on oh.OrderID = o.OrderID
      inner join [dbo].[tbl_Login] lo on o.UserID = lo.UserID
      inner join dbo.tbl_OrderStatus os on oh.OrderStatusID= os.OrderStatusID
  group by o.OrderID,o.Nature,od.TotalPrice,o.Date,os.OrderStatus,lo.FirstName,lo.EmailAddress,lo.PhoneNumber
  </code></pre>
  
  <p>and this is my try</p>
  
  <pre><code>public override orderDetailModel orderDetails(int id)
  {
      var results = from o in obj.Orders
          join od in obj.tbl_OrderDetails on o.OrderID equals od.OrderID
          join oh in obj.tbl_OrderHistory on o.OrderID equals oh.OrderID
          join l in obj.tbl_Login on o.UserID equals l.UserID
          join os in obj.tbl_OrderStatus on oh.OrderStatusID equals os.OrderStatusID
          where (od.OrderID == id)
          group o by new { o.Nature, o.OrderID } into 
          select new orderDetailModel
          {
              OrderID = o.OrderID,
              OrderStatus = os.OrderStatus,
              Date = o.Date,
              DeliveryNature = o.Nature,
              EmailAddress = l.EmailAddress,
              FirstName = l.FirstName,
              PhoneNumber = l.PhoneNumber,
              TotalPrice = od.TotalPrice
          };
      //group o by new {o.OrderID};
      orderDetailModel data = (orderDetailModel)results.FirstOrDefault();
      return data;
  }
  </code></pre>
  
  <p>but this is wrong query its not working fine please help me </p>