Help w/ query

R

Rance R

In db I have inherited I have 2 related tables:

Table 1: tblPerson - contains all employees users.
COLUMNS OF INTEREST ARE:
PKPersonID(Long-Autonumber): Primary Key
LName(text)= Last Name
FName(text) = First Name
FKSupervisorID(Long): FK to tblPerson. Person that this
person reports to.
HireDate(Date): self-explanatory
TerminationDate: self-explanatory

Table 2: tblEmployeeHistory - history of changes to
tblPerson
COLUMNS OF INTEREST ARE:
FKPersonID(Long): FK to tblPerson
AffectedField(text): Column of value changed in tblPerson
NewValue(text): new value in affected field of tblPerson
EffectiveDate(date): date of change

I need to bring together for a report to get all of the
users for a particular FKSupervisorID during a particular
month. I either need info from tblPerson (person has
always worked for supervisor, has not terminated in date
range, no changes so no entries in tblEmployeeHistory) OR
info from tblEmployeeHistory (person has entries in this
table because has moved since hire date and for
particular date range I need to know if he worked for the
supervisor of interest, i.e.,AffectField = "FKSupervisor"
and NewValue = PKPersonID of supervisor(but as text).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top