title: count occurrences for each week using db2
body: <p>I am looking for some general advice rather than a solution. My problem is that I have a list of dates per person where due to administrative procedures, a person may have multiple records stored for this one instance, yet the date recorded is when the data was entered in as this person is passed through the paper trail. I understand this is quite difficult to explain so I'll give an example:</p>
  
  <pre><code>Person     Date            Audit
  ------     ----            -----
  1          2000-01-01      A
  1          2000-01-01      B
  1          2000-01-02      C
  1          2003-04-01      A
  1          2003-04-03      A
  </code></pre>
  
  <p>where I want to know how many valid records a person has by removing annoying audits that have recorded the date as the day the data was entered, rather than the date the person first arrives in the dataset. So for the above person I am only interested in:</p>
  
  <pre><code>Person     Date            Audit
  ------     ----            -----
  1          2000-01-01      A
  1          2003-04-01      A
  </code></pre>
  
  <p>what makes this problem difficult is that I do not have the luxury of an audit column (the audit column here is just to present how to data is collected). I merely have dates. So one way where I could crudely count real events (and remove repeat audit data) is to look at individual weeks within a persons' history and <strong>if a record(s) exists for a given week, add 1 to my counter</strong>. This way even though there are multiple records split over a few days, I am only counting the succession of dates as one record (which after all I am counting by date).</p>
  
  <p>So does anyone know of any db2 functions that could help me solve this problem?</p>