title: Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1064
body: <p>i m trying to add this query into my code in laravel.
  it runs smoothly in phpmyadmin or with mysql command line but enable to get anything but this syntax error.</p>
  <p>my query :</p>
  <pre><code>$query_sql=&quot; CREATE TEMPORARY TABLE F as( 
                          SELECT * from (
                              select M.* ,M2.idA from (
                                          SELECT  o.id , o_n.id_n as idD from o ,o_n where FIND_WILD_IN_SET(o.id,o_n.id_o)
                                          and o_n.id_n IN ({$start_n_string})
                                      ) M  
                              JOIN ( SELECT  o.id , o_n.id_n as idA from o,o_n where FIND_WILD_IN_SET(o.id,o_n.id_o)
                                      and o_n.id_n IN ({$end_n_string})
                              ) M2 on M.id = M2.id GROUP by id
                          ) x
                      );
  
  
  SELECT o.* from o
                  where o.id IN ( 
                      select id_offre from o_rv join F on F.id = o_rv.id_offre 
                      where find_in_set(idD,o_rv.id_n]) &lt; find_in_set(idA,os_rv.id_n)
                      )&quot;;
              
          $list_pot_r=DB::select($query_sql);
  </code></pre>
  <blockquote>
  <p>SQLSTATE[42000]: Syntax error or access violation: 1064 You have an
  error in your SQL syntax; check the manual that corresponds to your
  MySQL server version for the right syntax to use near 'select o.* from
  o</p>
  </blockquote>
  <p><em><strong>NOTE:</strong></em></p>
  <ul>
  <li>Tried 'strict' -&gt; false</li>
  <li>Using DB::select();</li>
  <li>DB::unprepared() the only that doesnt return any error but it doesnt
  return the result neither only a (TRUE)</li>
  </ul>
  <p><em><strong>EDIT</strong></em></p>
  <p>when i remove the last statment i get this :</p>
  <blockquote>
  <p>SQLSTATE[HY000]: General error: 2014 Cannot execute queries while
  other unbuffered queries are active.  Consider using
  PDOStatement::fetchAll().  Alternatively, if your code is only ever
  going to run against mysql, you may enable query buffering by setting
  the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.</p>
  </blockquote>