1
Good morning. I have the following SQL running:
UPDATE pessoas SET implante = true FROM saida WHERE saida.prontuario = pessoas.prontuario
and saida.mes LIKE (date_part('MONTH', CURRENT_DATE) || '%')
On the table pessoas
are all records. In the table saida
are only the records previously included. Thus, in the table saida
there are not all the pessoas
. It is possible that when running SQL above, in addition to registering the field implante
as true according to the instruction, also record as false the rest of the field records implante
table pessoas
?
Kind of strange, this condition of yours
saida.mes LIKE (date_part('MONTH', CURRENT_DATE) || '%')
. You have not reported what kind of datasida.mes
but a comparison for equality without the use ofLIKE
? The return of functiondate_part
is a double and then concatenates with '%', apparently unnecessary complications.– anonimo