title: Translate raw query into Query Builder in CakePHP 3.x
body: <p>This is my query</p>
  
  <pre><code>INSERT INTO users_access_dynamic_views (dynamic_view_id, user_id, ordinal_ranking) 
  SELECT ?, u.user_id, COUNT(uav.id) + 1 from users_access_dynamic_views uav
    RIGHT JOIN users_in_circles u ON uav.user_id = u.user_id 
  WHERE u.circle_id = ?
  GROUP BY u.user_id
  </code></pre>
  
  <p>The first <code>?</code> should be replaced by a PHP variable like <code>$viewId</code> and the second by <code>$circleId</code>.</p>
  
  <p>How do I use the <a href="http://book.cakephp.org/3.0/en/orm/query-builder.html" rel="nofollow">Query Builder</a> to create this? Do I need to use subquery?</p>