Kikster813
Programmer
I have a table (tblPROREmpMemberStatus)with a foreign ID, code, start date and end date. There can be multiple records per foreign ID.
I want to update another table (tblPREmpDeduductions) with the values from the record from the first table that has the most recent start date.
This is what I'm trying to do:
And I get the error:
The multi-part identifier "tblPREmpDeductions.ID" could not be bound.
See my attachment for screen shots of tables with data.
I want to update another table (tblPREmpDeduductions) with the values from the record from the first table that has the most recent start date.
This is what I'm trying to do:
Code:
update tblPREmpDeductions set ORRetMemberStatus = a.orstatuscode, ORRetMemberStatusBeginDate = a.orstatusbegdate, ORRetMemberStatusEndDate = a.orstatusenddate
FROM (Select Top 1 * FROM tblPROREmpMemberStatus where tblPREmpDeductions.ID = tblPROREmpMemberStatus.tblPREmpDeductionsID Order by ORStatusBegDate DESC) a
And I get the error:
The multi-part identifier "tblPREmpDeductions.ID" could not be bound.
See my attachment for screen shots of tables with data.