Posted by eighthman11 on 01/08/07 16:19
Hi everyone. I am updating a table with aggregate results for multiple
columns. Below is an example of how I approached this. It works fine
but is pretty slow. Anyone have an idea how to increase performance.
Thanks for any help.
UPDATE #MyTable
SET HireDate=(Select Min(Case When Code = 'OHDATE' then DateChanged
else null end)
From HREH
Where #MyTable.HRCo=HREH.HRCo and
#MyTable.HRRef=HREH.HRRef ),
TerminationDate=(select Max(Case When Type = 'N' then
DateChanged else null end)
From HREH
Where #MyTable.HRCo=HREH.HRCo and
#MyTable.HRRef=HREH.HRRef ),
ReHireDate=(select MAX(Case When Code = 'HIRE' then
DateChanged else null end)
From HREH
Where #MyTable.HRCo=HREH.HRCo and #MyTable.HRRef=HREH.HRRef )
Navigation:
[Reply to this message]
|