title: Stored function computes incorrect value
body: <p>I have a function that should return the value of only one element, but this is returning from every table
  
  <pre><code>Function verify(idAluno INT) returns INT
  BEGIN
      DECLARE teste INT;
      SELECT COUNT(status) into teste FROM listapresenca WHERE idAluno = idaluno;
      RETURN teste;
  END
  </code></pre>
  
  <p>The values from the listapresenca is</p>
  
  <pre><code>idAluno status  horario
  1       ENTROU  2018-09-02 21:46:25
  0       NAO     2018-09-02 21:46:43
  0       NAO     2018-09-02 21:46:45
  0       NAO     2018-09-02 21:46:46
  0       NAO     2018-09-02 21:46:48
  0       NAO     2018-09-02 21:59:10
  </code></pre>
  
  <p>The result from putting the variable idaluno = 1 should be 1, but it is returning 6.</p>
  
  <p>if I use outside the function <code>SELECT COUNT(status) FROM listapresenca WHERE idAluno = 1</code>, the return value is 1</p>