lcCode = emails.Code update Email_Anexo set Spam = .F. where exists (select 1 from Email_Anexo EA where ID = lcCode and ID = Email_Anexo.ID) update Email_Anexo set Spam = .T. where not exists (select 1 from Email_Anexo EA where ID = lcCode and ID = Email_Anexo.ID)Or simply
update EMail_Anexo set Spam = .F. where ID = lcCode update EMail_Anexo set Spam = .T. where ID <> lcCodeFinally, using Borislav's idea simply
replace all Spam with ID <> lcCode in Email_Anexo