title: Find the count of duplicate records in talend and java
body: <p>I have a table in postgresql which has duplicate numbers in a column. I am using Tpostgresqlinput and a query in this as : </p>
  
  <pre><code>select number , count(1) from abc.xyz having count(1)&gt;1 group by number
  </code></pre>
  
  <p>After this component, I am using tFlowToIterate and then  Tjavaflex. In tJavaflex , I am using</p>
  
  <p>Startcode as :</p>
  
  <pre><code>int count = 0; count++;
  </code></pre>
  
  <p>Maincode as :</p>
  
  <pre><code>if (count&gt;1) 
  ("row1.serial_number",row1.serial_number)
      System.out.println(row1.serial_number);
  else
      System.out.println("Duplicates are not found");
  </code></pre>
  
  <p>But I am getting the output with the else part as Duplicates are not found.
  <br><strong>How do I find the count and name of those serial numbers if it is more than 0 ?</strong>
  <br>Ideally , the serial numbers should be unique but then there are duplicate serial numbers in the data.So I want to find the duplicate serial number and its count only if it is greater than 1 as an output.
  Expected output should be : if there are duplicates ie if the count of serial number is more than 1 then it should send a mail notification to the user that those serial numbers have the count more than 1 ie the serial number and the count no.</p>
  
  <p></p>