update AS_USRPWD set UPW_AsignarCM = 1 where UPW_Id in (
select distinct(au.UPW_Id) from AS_USRPWD au
join AS_CAMBIOMEDIACION ac on au.USR_IdTesis = ac.CMD_TramitadorTesis
where au.UPW_AsignarCM = 0
);