title: left join with ActiveRecord (yii2)
body: <p>I tried to send SQL request with LEFT JOIN but it doesn't display data from <code>table2</code> table.</p>
  
  <pre><code>public static function top($limit)
  {
      return self::findBySql("
          SELECT * FROM table 1 g1 
          LEFT JOIN table2 s1 
          ON (g1.id = s1.g_id AND s1.id = (
              SELECT MAX(id) 
              FROM table2 s2 WHERE s2.g_id = g1.id
          )) 
          LIMIT :limit", 
      [':limit' =&gt; $limit]
      )-&gt;all();
  }
  </code></pre>