title: Inserting a rank in sequential order for grouped records in a table
body: <p>I am trying to look for the best way to assign values to records in a table starting with the value 1 and incrementally going forward by the value 1.  The table contains records on a date by date basis for which there are multiple records per date.  I need a solution (perhaps a loop) that will go date-by-date and insert a rank number for each starting with the number one and incrementing itself by one for each record.  As soon as a new date is identified, I need to start with the value one again.  For example if I have the following 6 records with the 4 fields 'Date', 'User', 'User ID' and want update the field 'sequence' using this logic, my code will (1) group all records by date, (2) sort by user ID and (3) reveal the following result in the field 'Sequence':</p>
  
  <pre><code>Date         | User      | User ID | Sequence
  4 September  | Mary      |    09   | 1
  4 September  | Bob       |    58   | 2
  4 September  | Dave      |    59   | 3
  5 September  | Drew      |    32   | 1
  5 September  | Steve     |    35   | 2
  6 September  | Mary      |    09   | 1
  </code></pre>
  
  <p>I realise I need to do some type of loop on a day-by-day basis but need help getting started.</p>