title: How to exclude results from my resultset based on a different row?
body: <p>I have one table t1 with clientdivisionid, planid, memberid and values are </p>
  
  <p>154 | 722 | 27510,<br>
  154 | 722 | 22222,<br>
  154 | 725 | 27510</p>
  
  <p>I need to pull only members where planID = 722 for members who are not part of plan 725. </p>
  
  <p>So result should be<br>
   154| 722 | 22222</p>
  
  <p>here is my SQL</p>
  
  <pre><code>Select memberid,planid 
  from t1 
  group by memberid,planid
   having ((planid = 722) and (planid &lt;&gt; 725 ))
  </code></pre>
  
  <p>When I use where or having statement it still pulls in member id 27510. </p>