title: pyspark trying to retrieve rows having same id
body: <p>I am using spark 2.1.0. Below is my dataframe. The problem statement is from b column I need to retrieve rows which are having same values in a and different values in b . Resulting dataframe is mentioned </p>
  
  <pre><code>a   b
  
  1   2
  
  1   3
  
  1   4
  
  2   6
  
  3   7
  </code></pre>
  
  <p>Resulting dataframe:</p>
  
  <pre><code>a b
  
  1 2
  
  1 3
  
  1 4
  </code></pre>
  
  <p>I used the code below but it is not working</p>
  
  <pre><code>sqlCtx.sql("select * from df1 group by a,b having count(a)&gt;=2")
  </code></pre>
  
  <p>Please help me in resolving the issue.</p>