title: Request to MySQL
body: <p>I need to execute the following request to the MySQL server from symfony.</p>
  
  <pre><code>SELECT  count(DISTINCT hotel_id) FROM symfony.search_result where request_id=@requrst_id 
  </code></pre>
  
  <p>Code:</p>
  
  <p>In controller:</p>
  
  <pre><code>  $qwery2=$repository-&gt;hotelsCount($searchId);
  </code></pre>
  
  <p>Function:</p>
  
  <pre><code> public function hotelsCount($requestId){
  
          $qb = $this-&gt;createQueryBuilder('self');
          $qb-&gt;select('count(hotel_id)')
          -&gt;where('self.request_id=:req_id')
          -&gt;setParameter('self.req_id',$requestId)-&gt;getQuery()-&gt;getResult();
          $rez=$qb-&gt;getQuery()-&gt;getSingleScalarResult();
          var_dump($rez);
          return $rez-&gt;fetchAll();
      }
  </code></pre>
  
  <p>But i got error:
  [Semantical Error] <code>line 0, col 13 near 'hotel_id) FROM': Error: 'hotel_id' is not defined.</code></p>
  
  <p>Table: <a href="https://i.stack.imgur.com/Y2rSI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y2rSI.png" alt="enter image description here"></a></p>