title: Create left join with dynamic where
body: <p>I am trying to create common function for querying data with dynamic where predicate on input.</p>
  <pre><code>public async Task&lt;IList&lt;T&gt;&gt; Get(Expression&lt;Func&lt;T, bool&gt;&gt; predicate)
      {
          var objects = await (from t1 in db.Table1
                              join t2 in db.Table2 on t1.Id equals t2.Id into Group
                              from t2 in Group.Where(x =&gt; x.StopDate.Equals(null)).DefaultIfEmpty()
                              orderby t1.Name
                              group t2 by new { t1.Id, Name, t1.Desc, t1.StartDate, t1.StopDate } into grouped
                              select new T()
                              {
                                  Id = grouped.Key.Id,                                
                                  Name = grouped.Key.Name,
                                  Desc = grouped.Key.Desc,
                                  StartDate = grouped.Key.StartDate,
                                  StopDate = grouped.Key.StopDate
                              }).Where(predicate).ToListAsync();
  
          ArgumentNullException.ThrowIfNull(objects);
  
          return objects;
      }
  </code></pre>
  <p>I want to use columns from both tables in predicate. How to implement it? I can use columns from second table in where condition.
  Thanks</p>