title: oracle sql not a group by expression while counting
body: <p>i'm trying to run the following query that counts the number of doctors with patient referrals within the last 6 months:</p>
  
  <pre><code>SELECT 
      count(local_doc.providerno) NumberofReferals, 
      LOCAL_DOC.FULLNAME FULLNAME, 
      LOCAL_DOC.TELNUMBER TELNUMBER, 
      LOCAL_DOC.STREET STREET, 
      LOCAL_DOC.SUBURB SUBURB, 
      LOCAL_DOC.STATE STATE, 
      LOCAL_DOC.POSTCODE POSTCODE,
      LOCAL_DOC.PROVIDERNO
  FROM 
      LOCAL_DOC, 
      PATIENT 
  WHERE 
      PATIENT.PROVIDERNO = LOCAL_DOC.PROVIDERNO AND PATIENT.REFERALDATE &lt;= sysdate AND PATIENT.REFERALDATE &gt;= ADD_MONTHS(sysdate, -6)
      group by local_doc.providerno;
  </code></pre>
  
  <p>i keep getting </p>
  
  <pre><code>ORA-00979: not a GROUP BY expression
  00979. 00000 -  "not a GROUP BY expression"
  *Cause:    
  *Action:
  Error at Line: 3 Column: 5
  </code></pre>
  
  <p>and have no idea how to get around this. How could I do so?</p>