title: How to compare dates for multiple rows under the same table and same account
body: <p>If any SQL gurus could point me in the right direction on this would be a huge help. I'm learning SQL and want to create a report that would generate the Account #s under the <em>same</em> Person ID that were created &lt;= 30 days of each other and exclude any others. All the information needed is in the same table.</p>
  
  <p>For example this code pulls up a list of Person's with the same personid who have more than one Accountid and their Creation date:</p>
  
  <pre><code>    select accounttid, creationdate, personid from Table1 where personid in ( 
      select (personid) from Table1 group by personid having COUNT (accountid) &gt; 1)
  
  
  EXAMPLE RESULT:
      accountid   creationdate    personid
      5501624 2013-05-01  101
      5501544 2013-05-03  101
      5510220 2013-10-24  10337
      5504204 2013-06-27  10337
      5502332 2013-05-21  1047
      5502628 2013-05-28  1047
      5508844 2013-10-01  1047
  </code></pre>
  
  <p>Not sure where to go from here. I want to then take these Accountids and somehow compare the Creationdates for less than or equal to a 30 day differential but only compare them when the PersonIDs are the same.</p>