title: Change SQL into Query Builder in Laravel
body: <p>This is my SQL statement</p>
  
  <pre><code>SELECT `pams_users`.display_name,`pams_user_levels`.description FROM pams_users 
  JOIN pams_developer ON `pams_users`.developer_id=`pams_developer`.id AND `pams_developer`.id=27 OR `pams_users`.`parent_dev`=27
  JOIN pams_user_levels ON `pams_user_levels`.id=`pams_users`.user_level AND `pams_user_levels`.id=6
  GROUP BY  `pams_users`.display_name   
  </code></pre>
  
  <p>This is my query builder based on the SQL</p>
  
  <pre><code> DB::table('pams_users')
          -&gt;join('pams_developer','pams_developer.id','pams_users.developer_id')
          -&gt;join('pams_user_levels','pams_user_levels.id','pams_users.user_level')
          -&gt;where('pams_developer.id',27)
          -&gt;orWhere('pams_users.parent_dev',27)
          -&gt;where('pams_user_levels.id',6)
          -&gt;select('developer_name','description','display_name')
          -&gt;selectRaw('count(pams_users.id) as count')
          -&gt;groupBy('display_name')
          -&gt;get();
  </code></pre>
  
  <p>However, the query builder did not show any error but show different result with the SQL statement.<br>
  Anyone can figure out my query builder problem ?<br>
  Any suggestion and comment on my query builder is appreciated.</p>
  
  <hr>