Do you need to UPDATE the EmailJacket.Completed = 1 just for that view?? (if so use CASE, this isn't really an "UPDATE" though)...or do you actually have to go back to the table and make the change to it? Here's something I threw together real quick, it should work though...
Code:
UPDATE EmailJacket
set Completed = 1
where Name in
(select distinct Name
from (SELECT
ESS.EmailJacketKey,
COUNT(DISTINCT ESS.EmailWizardStepKey),
EmailJacket.Name,
EmailJacket.Completed,
EmailJacket.ModificationDate
FROM
EmailWizardStepStatus AS ESS INNER JOIN EmailJacket AS EmailJacket
ON ESS.EmailJacketKey = EmailJacket.EmailJacketKey
WHERE
ESS.Completed = 1 AND EmailJacket.Queued = 0
GROUP BY
ESS.EmailJacketKey, EmailJacket.Name, EmailJacket.ModificationDate, EmailJacket.Completed
HAVING
COUNT(DISTINCT ESS.EmailWizardStepKey) =
(SELECT MAX(StepNumber)
FROM DevPortal..EmailWizardStep
WHERE WizPath = 1)
) as A
)
Bookmarks