title: SQL Query Question (Possible Join / Subquery?)
body: <p>I have two tables (<strong>Management</strong> and <strong>Employee</strong>). </p>
  
  <p>The management table tracks the different management teams that have managed company X in past few years. Each management team is given an ID (i.e: managementnr), and each team has a CEO (namely ceoname). </p>
  
  <p>The employee table tracks employees working for company X (basically just their names and which management team hired them)</p>
  
  <p>Here is the SQL code:</p>
  
  <pre><code>
  CREATE TABLE EMPLOYEE(
      EMPLOYEENAME   VARCHAR2(15) NOT NULL,
      HIRETEAM NUMBER(2), 
      PRIMARY KEY (EMPLOYEENAME)
      );
  
  CREATE TABLE MANAGEMENT(
      MANAGEMENTNR NUMBER(2) NOT NULL,
      CEONAME VARCHAR2(20) NOT NULL,
      PRIMARY KEY (MANAGEMENTNR,CEONAME)
      );  
  </code></pre>
  
  <p>I'm trying to form an SQL query to get the managementNR in which the highest number of employees have been hired. 
  I've tried using: </p>
  
  <pre><code>SELECT HIRETEAM,max(count(HIRETEAM)) 
   from EMPLOYEE 
  group by HIRETEAM
  </code></pre>
  
  <p>but I keep getting: </p>
  
  <pre><code>  ORA-00937: not a single-group group function 
  </code></pre>
  
  <p>(I'm using Oracle)</p>
  
  <p>After hours of Google-fu, I finally understand what this error means, however I still cannot think of any other way to form this query. I've tried using subqueries / joins, but  still nothing. I'm very new to SQL in general. If anybody can help, I would be really grateful! </p>
  
  <p>Thank you for your time =]<br>
  --Evan Lestrange</p>