Two months ago something happened to a server that caused a bunch of data collected by an application to corrupt a field. The database is a collection of information about employees, some served from another database (where the problem originated) and some collected in a form.
To simplify, there are really only 4 fields that come into play here on a table called HDData:
ID (assigned integer primary key)
EmpID
Campus
Dt
The problem with the data is that for 2 months 'Campus' has been showing 'unknown', causing much grief in sorting. I want to find the update all the 'unknowns' for a particular EmpID, but based on the most recent date for which Campus was not unknown.
The pseudocode for what I want to do is roughly this:
For each EmpID
where the campus is not "unknown"
And date is nearest date
select the campus
update all instances of campus for that EmpID where it is 'unknown' to the value selected
The pseudocode does not really match SQL, so I am worried that I might have to use VBA for this, or maybe I am just writing it out of order.
Can this be done without using VBA? Any hints on how to accomplish something like this or a link to a similar problem on another thread?
To simplify, there are really only 4 fields that come into play here on a table called HDData:
ID (assigned integer primary key)
EmpID
Campus
Dt
The problem with the data is that for 2 months 'Campus' has been showing 'unknown', causing much grief in sorting. I want to find the update all the 'unknowns' for a particular EmpID, but based on the most recent date for which Campus was not unknown.
The pseudocode for what I want to do is roughly this:
For each EmpID
where the campus is not "unknown"
And date is nearest date
select the campus
update all instances of campus for that EmpID where it is 'unknown' to the value selected
The pseudocode does not really match SQL, so I am worried that I might have to use VBA for this, or maybe I am just writing it out of order.
Can this be done without using VBA? Any hints on how to accomplish something like this or a link to a similar problem on another thread?