title: Extbase Database-query with COUNT and GROUP BY
body: <p>I'm trying to make a DBquery in my Repository. I've already got one working, but what i wanted to was adapting it to use contraints instead of using setReturnRawQueryResult(TRUE). So i want to find all different types of $values in the table and count, how much of them exist. That's my code:</p>
  
  <pre><code>public function findAllDistinct($value, $category) {
  
      $query = $this-&gt;createQuery();
  
      $query-&gt;getQuerySettings()-&gt;setReturnRawQueryResult(TRUE);
  
      return $query
        -&gt;statement('SELECT ' . $value . ', COUNT(*) AS \'num\' '
                  . 'FROM tx_myextension_domain_model_job '
                  . 'WHERE job_category =' . $category . ' '
                  . 'GROUP BY ' .$value.'')
        -&gt;execute();
  }
  </code></pre>
  
  <p>And by the way, how to realize a "SELECT DISTINCT"?</p>