title: DB2 SQL: How to 'count' the amount of records returned by a having clause
body: <p>Table XRDK/WHSHIPP_R3 has 4 columns - ZNWHSE, ZNSITE, ZNMANE, ZNRECD with a total of 1,071 records.</p>
  
  <p>I have isolated the ZNMANE numbers that have been used more than once by;</p>
  
  <pre><code>SELECT ZNMANE FROM XRDK/WHSHIPP_R3
  GROUP BY ZNMANE                   
  HAVING (COUNT(ZNMANE) &gt;1)         
  ORDER BY 1
  </code></pre>
  
  <p>I would like a total count of these isolated records, but if I change it to;</p>
  
  <pre><code>SELECT COUNT(ZNMANE) FROM XRDK/WHSHIPP_R3
  GROUP BY ZNMANE                   
  HAVING (COUNT(ZNMANE) &gt;1)         
  ORDER BY 1
  </code></pre>
  
  <p>I just get a load of 2s which must be the individual count for each ZNMANE record.</p>
  
  <p>I tried this;</p>
  
  <pre><code>SELECT ZNMANE FROM XRDK/WHSHIPP_R3
  GROUP BY ZNMANE                   
  HAVING (COUNT(ZNMANE) &gt;1)         
  ORDER BY 1                        
  UNION ALL
  SELECT COUNT(ZNMANE) FROM XRDK/WHSHIPP_R3
  </code></pre>
  
  <p>But this returned 1071 at the top, so I guess it just counted the whole file. Any ideas?</p>