You can use the alias in the update
when you later define it in the from
clause. (This is a "perverse" situation where the alias is defined after its first use.)
UPDATE a3
set GroupId = (select TOP 1 a1.GroupID
from [dbo].[massmail_groupmaster] a1
where a1.[groupname] = a3.[groupname]
)
FROM [dbo].[massmail_emailmaster] a3;