title: SQL COUNT FORM JOIN TABLES
body: <p>I have the following sql command:</p>
  
  <pre><code>SELECT "USERNAME"."TOPICS".VALUE,
         "USERNAME"."TOPICS".QID,
         "USERNAME"."QUESTION".QRATING
  FROM "USERNAME"."TOPICS" JOIN "USERNAME"."QUESTION"
  ON "USERNAME"."TOPICS".QID = "USERNAME"."QUESTION".QID 
  AND "USERNAME"."TOPICS".VALUE = 'kia'
  ORDER BY QRATING DESC
  </code></pre>
  
  <p>It works really well, but I want to count how many element returns.  So I tried to use:</p>
  
  <pre><code>SELECT COUNT("USERNAME"."TOPICS".QID)
  FROM "USERNAME"."TOPICS" JOIN "USERNAME"."QUESTION"
  ON "USERNAME"."TOPICS".QID = "USERNAME"."QUESTION".QID 
  AND "USERNAME"."TOPICS".VALUE = 'kia'
  ORDER BY QRATING DESC
  </code></pre>
  
  <p>But I get the error :</p>
  
  <blockquote>
    <p>Column reference 'USERNAME.TOPICS.VALUE' is invalid. When the SELECT
    list contains at least one aggregate then all entries must be valid
    aggregate expressions.</p>
  </blockquote>
  
  <p>What is the problem?</p>