Reply to UPDATE a table with aggregate results for multiple columns

Your name:

Reply:


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 )

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация