title: Oracle SQL Two Group function why can't be in the same select?
body: <p>I have two table, defined by this create statement</p>
  
  <pre><code>CREATE TABLE PROJECT (project_name varchar(255), project_budget int, dedicated_project_leader int, dedicated_lead_developer int, dedicated_lead_consultant int, company_id int, project_id int, PRIMARY KEY (project_id));
  CREATE TABLE WORKER (worker_name varchar(255), worker_salary int, worker_anual_bonus int, worker_type varchar(255), leader int, company_id int, project_id int, worker_id int, PRIMARY KEY (worker_id));
  </code></pre>
  
  <p>I'd like to ask for the sum of the budgets of the project than divide it by the number of the workers---)</p>
  
  <pre><code>SELECT (SUM(p.project_budget) / (SELECT count(WORKER.WORKER_NAME) from WORKER)) as AVG_BONUS
    FROM PROJECT p;
  </code></pre>
  
  <p>Unfortunateley this raise an "ORA--00937:not a single-group group function" exception.</p>
  
  <p>However if i execute this query:</p>
  
  <pre><code>SELECT count(WORKER.WORKER_NAME) from WORKER)
  </code></pre>
  
  <p>The result will be:</p>
  
  <pre><code>16
  </code></pre>
  
  <p>And if i divide the summa of budgets with the number instead of the result:</p>
  
  <pre><code>SELECT (SUM(p.project_budget) / 16) as AVG_BONUS
        FROM PROJECT p;
  </code></pre>
  
  <p>I also got a perfect result e.g.:</p>
  
  <pre><code>294117,647058823
  </code></pre>
  
  <p>The solution is that i need to group by some id defined at the project table, but  don't think it is logical....</p>
  
  <pre><code>SELECT (SUM(p.project_budget) / (SELECT count(WORKER.WORKER_NAME) from WORKER)) as AVG_BONUS
    FROM PROJECT p
     GROUP BY p.company_id;
  </code></pre>
  
  <p>It is also working.</p>
  
  <p>Is anyone has a suggestion why can't i use it? (I have a feeling it is only an sql language specification that there can not exist two group function at a select without group by...)</p>