title: Left Join with Linq Method Syntax
body: <p>I am new in linq and struggling with it.</p>
  <p>I have T-SQL query and am trying to convert a linq query. I have some problems with joining tables.</p>
  <p>Here the T-SQL query:</p>
  <pre><code>    SELECT CAST(CREATE AS DATE) CREATEDATE
             A.ID,
             100 AS PRODUCTTYPE,
             SUM(ELEMENTCOUNT) AS NUMOFITEMS,
             SUM(ELEMENTCOUNT)*(CASE WHEN A.USERID=C.USERID AND PRODUCTTYPE=100 THEN C.PRICE ELSE 10 END) AS TOTALPRICE
      FROM PRODUCTLIST A LEFT JOIN PRICELIST C ON A.USERID=C.USERID
      WHERE CAST(CREATE AS DATE)&gt;='2021-01-01'
      GROUP BY CAST(CREATE AS DATE), A.ID
  </code></pre>
  <p>And here the C# code:</p>
  <pre><code> var soldProducts = _context.ProductList
              .Where(x =&gt; x.Created.Value.Date &gt;= &quot;2021-01-01&quot;)
              .GroupBy(t =&gt; new { t.Created.Value.Date, t.UserId})
              .Select(i =&gt; new SoldProductList()
              {
                  Date = i.Key.Date,
                  UserId = i.Key.UserId,
                  ProductType = 100,
                  NumOfItems = i.Sum(y =&gt; y.ElementCount),
                  TotalPrice = i.Sum(y =&gt; y.ElementCount * ( **??**  ))
              }).ToList();
  </code></pre>
  <p>In the <code>y.ElementCount * ( **??**  )</code>part I want to say that if the UserId in ProductList equals to the UserId in PriceList, take this price; else take the price as 10. So I need to join ProductList and PriceList.</p>
  <p>I try to implement GroupJoin but can not understand the resultSelector part, Why am I need result selector, if I need how can I implemet in this code.</p>