Update a Table with Running Counts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Trevor Bundy
    New Member
    • Feb 2012
    • 1

    Update a Table with Running Counts

    I would like to update a field in a table named ‘010 Consolidated Data’. The field that I want to update is ‘Begin Date #’. The value that I want to add to ‘Begin Date #’ depends on two other fields: a field with employee numbers, ‘Employee’, and a field with dates, ‘Beginning Date’. For each employee number, I want to count how many different Beginning Dates there are and update the ‘Begin Date #’ field with a running count. For example…if employee 1 has three different dates (on 3 rows); the first row would have a 1 in the ‘Begin Date #’ field, the second row would have a 2 and the third a 3. Employee number 2 might have two dates and the values for these two rows would be 1 and 2 respectively. I would need to update a table with roughly 400 employees and 1000 rows. I would appreciate your thoughts! Thank you!
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    First of all, don't do that. Use the running sum functionality in the reports for that or use a ranking query.

    If speed is really an issue and speed is more important than data integrity, use a ranking query to update the table.

    Comment

    Working...