title: Eloquent: Complex Script
body: <p>Good day!</p>
  
  <p>can be possible to change this script to <strong>Eloquent Laravel</strong></p>
  
  <pre><code>SELECT concat(firstname, " ",lastname) as fullname,q_title,answer FROM `user_pivot_survey_answer` as upsa 
  LEFT JOIN (SELECT id,q_title FROM survey_question) sq ON upsa.qid = sq.id
  LEFT JOIN (SELECT id,firstname,lastname FROM user_survey_answer) usa ON upsa.sid = usa.id
  </code></pre>
  
  <p>I translate it already to Eloquent, however, I don't know if is working</p>
  
  
  
  <pre class="lang-php prettyprint-override"><code> $testquery = DB::table('user_pivot_survey_answer')
       -&gt;leftJoin(DB::select('SELECT id,q_title FROM survey_question'),function($join)) {
              $join-&gt;on('user_pivot_survey_answer.id', '=', 'survey_question.id'); 
        })
        -&gt;leftJoin(DB::select('SELECT id,firstname,lastname FROM user_survey_answer'),function($join){
              $join-&gt;on('user_pivot_survey_answer.id', '=', 'user_survey_answer.id');
        });
  </code></pre>
  
  <p>Thanks</p>