title: DB2 - how to find count multiple occurrences of column value
body: <p>Im new to DB2 , and tried based on some similar posts, I have a table where I need to find the count of IDs based on where status=P and 
   the count of(primary=1) more than once.
  so my result should be 2 here - (9876,3456)
  Tried:</p>
  
  <pre><code>SELECT id, COUNT(isprimary) Counts
    FROM table 
   GROUP BY id
  HAVING COUNT(isprimary)=1;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/P7BW6.png" alt="enter image description here"></p>