title: how to get this sql query
body: <p>hello everyone I have a problem for this query, I need to get the rows where the id has the same numbers:</p>
  
  <pre><code>id2 |  num
  ----+------
  28  | 6
  28  | 104
  28  | 106
  50  | 6
  50  | 104
  </code></pre>
  
  <p>expected result:</p>
  
  <pre><code>id2 | num
  ----+-----
  28  | 6
  28  | 104
  50  | 6
  50  | 104
  </code></pre>
  
  <p>result doesn't include <code>28 106</code> because there's no <code>50 106</code> .</p>
  
  <p>case 2: </p>
  
  <pre><code>id2 | num
  ----+-----
  29  | 1
  30  | 1
  31  | 1
  </code></pre>
  
  <p>expected result:</p>
  
  <pre><code>id2 | num
  ----+-----
  29  | 1
  30  | 1
  31  | 1
  </code></pre>
  
  <p>retrieves all because all the ids have num equal to 1</p>
  
  <p>these numbers are random the condition is that if there are more than two ids they must have the same numbers in column 2</p>