title: Count occurrences of character in a string and Group By with SQL
body: <p>I try to count occurrences and to add group by after, but I have an error</p>
  
  <blockquote>
    <p>SELECT list is not in GROUP BY clause and contains nonaggregated
    column ‘bdd.my_table.text' which is not functionally dependent on
    columns in GROUP BY clause; this is incompatible with
    sql_mode=only_full_group_by</p>
  </blockquote>
  
  <p>My table :</p>
  
  <pre><code>id | book | chapter | text
   1 |   1  |    1    | 'hello hello world'
   2 |   1  |    2    | 'hello hello hello hello'
   3 |   1  |    3    | 'world'
   4 |   1  |    4    | 'hello test'
  </code></pre>
  
  <p>I execute my request :</p>
  
  <pre><code>SELECT 
      book,
      chapter,
      text,    
      ROUND (   
          (
              LENGTH(text)
              - LENGTH( REPLACE ( text, "hello", "") ) 
          ) / LENGTH("hello")        
      ) AS count    
  FROM my_table
  WHERE book=43
  GROUP BY chapter
  </code></pre>
  
  <p>I would like this result :</p>
  
  <pre><code>book | chapter | count
  ----------------------
    43  |    1    |   2
    43  |    2    |   4
    43  |    3    |   0
    43  |    4    |   1
  </code></pre>
  
  <p>I tried to add this before the request to remove 'only_full_group_by', but I have the same problem</p>
  
  <pre><code>SET SESSION group_concat_max_len = 1000000;
  </code></pre>