title: Checking if multiple entries exist in SQL, delet them and add a new one
body: <p>I have table with column <code>RowId</code>, <code>PersonId</code>, <code>ActivityTypeId</code>, <code>GroupId</code>, I select above column and it works fine.</p>
  
  <p><strong>Bit of above table data</strong>
  Above data can have data like, same <code>`PersonId</code> can have multiple <code>activityTypeId</code> and activityTypeId have <code>GroupId</code>. Something like this</p>
  
  <pre><code>RowId  PersonId ActivityTypeId GroupId
  1       20          1             2
  2       20          2             2
  3       20          7             8
  </code></pre>
  
  <p>Now my problem is, If for particular <code>PersonId</code>, there are more than 3 entries in same group. I wish to delete all entries of that person while selecting and add a new one manually. Can this be done in Store Procedure?</p>
  
  <p>Any help will be appreciated.</p>
  
  <p>Apologies, if Title doesnt make sense.</p>