title: Oracle SQL Count function
body: <p>I am hoping someone can advise on the below please?
  I have some code (below), it is pulling the data I need with no issues. I have been trying (in vain) to add a COUNT function in here somewhere. The output I am looking for would be a count of how many orders are assigned to each agent. I tried a few diffent things based on other questions but can't seem to get it correct. I think I am placing the COUNT 'Agent' statement and the GROUP BY in the wrong place. Please can someone advise? (I am using Oracle SQL Developer).</p>
  <pre><code>select
  n.ordernum as &quot;Order&quot;,
  h.employee as &quot;Name&quot;
  from ordermgmt n, orderheader h
  where h.ordernum = n.ordernum
  and h.employee_group IN ('ORDER.MGMT')
  and h.employee is NOT NULL
  and n.percentcomplete = '0'
  and h.order_status !='CLOSED'
  </code></pre>
  <p>Output I am looking for would be, for example:</p>
  <pre><code>Name         Orders Assigned
  Bob                 3
  Peter               6
  John                2
  </code></pre>
  <p>Thank you in advance</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">Name</th>
  <th style="text-align: center;">Total</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;"></td>
  <td style="text-align: center;">49</td>
  </tr>
  <tr>
  <td style="text-align: left;"></td>
  <td style="text-align: center;">49</td>
  </tr>
  <tr>
  <td style="text-align: left;"></td>
  <td style="text-align: center;">49</td>
  </tr>
  <tr>
  <td style="text-align: left;"></td>
  <td style="text-align: center;">49</td>
  </tr>
  <tr>
  <td style="text-align: left;"></td>
  <td style="text-align: center;">49</td>
  </tr>
  <tr>
  <td style="text-align: left;">John</td>
  <td style="text-align: center;">4</td>
  </tr>
  <tr>
  <td style="text-align: left;">John</td>
  <td style="text-align: center;">4</td>
  </tr>
  <tr>
  <td style="text-align: left;">John</td>
  <td style="text-align: center;">4</td>
  </tr>
  <tr>
  <td style="text-align: left;">John</td>
  <td style="text-align: center;">4</td>
  </tr>
  <tr>
  <td style="text-align: left;">Peter</td>
  <td style="text-align: center;">2</td>
  </tr>
  <tr>
  <td style="text-align: left;">Peter</td>
  <td style="text-align: center;">2</td>
  </tr>
  <tr>
  <td style="text-align: left;">Bob</td>
  <td style="text-align: center;">3</td>
  </tr>
  <tr>
  <td style="text-align: left;">Bob</td>
  <td style="text-align: center;">3</td>
  </tr>
  <tr>
  <td style="text-align: left;">Bob</td>
  <td style="text-align: center;">3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>for example. so there are 49 blank rows summed up as 49 in the Total column. I did not add the full 49 blank columns to save space</p>