Composite update

1

I have a table pessoas where, I have several fields referring to the person's registry, One of these fields is PES_NUMERO , which is nothing more than the code of the person in the system, well, I have another field called EST_NUMERO , where I inform which structure the person belongs to.

I need to update this EST_NUMERO according to a worksheet where I have the license plate number.

Below the code I wrote so they can understand better

USE RBACESSO_V100
GO
UPDATE PESSOAS 
SET EST_NUMERO = 100 -- Numero do código da estrutura que a pessoa deve receber.
WHERE PES_NUMERO = 1222244 -- Numero da matricula da pessoa a ser atualizada.

The command WHERE I inform the condition for update , only that I need to inform there several numbers of enrollment is not only one because I have about 2063 records to update, how do I put a kind of condition there to get all the registrations, something like a and ?

    
asked by anonymous 22.08.2016 / 21:43

1 answer

2

A simple way:

where pes_numero in ( a,b,c,d,e ) 

or

 where pes_numero in ( select matricula from tabela_matricula where 
     condicao ) 
    
22.08.2016 / 21:51