Include query in UPDATE command

Hello guys, I would like to know if it is possible to insert this query:

SELECT DISTINCT "3001. Dominios"."Selecionar" FROM "3001. Dominios do Paciente", "3001. Dominios", "Datas do Diagnostico" WHERE "3001. Dominios do Paciente"."ID_Dominios" = "3001. Dominios"."ID_Dominios" AND "Datas do Diagnostico"."Data" = "3001. Dominios do Paciente"."Data" AND "Datas do Diagnostico"."IDAnamnese" = "3001. Dominios do Paciente"."IDAnamnese"

In that UPDATE command:

UPDATE "3001. Dominios" SET "Selecionar" = TRUE

Because I want to update the Select (boolean) fields in the “Domains” table according to a specific “Patient”, as well as the Domain contained in the “Patient’s Domain” table and the “Date” for inclusion of those domains.

Hello,

The Update statement presented as is will set "Selecionar" = TRUE in ALL records. So it needs to have a condition met by using a Where clause. This would be the ID_Dominios of the record(s) to be updated.

The Query you present does not select this field but rather a Distinct value of a boolean field resulting in a TRUE or FALSE result. Depending upon the actual data this could be from many records and both results present. There is no observable data in this post or any sample/example data to determine results of the statement.

You need to determine the conditions for selecting the ID field necessary to update your records.

I understood the UPDATE logic through the post, thanks RATSLINGER. Follow the correct code:

UPDATE "3001. Dominios" SET "Selecionar" = TRUE WHERE "ID_Dominios" IN (SELECT DISTINCT "3001. Dominios"."ID_Dominios" FROM  "3001. Dominios", "3001. Dominios do Paciente", "Datas do Diagnostico" WHERE "3001. Dominios do Paciente"."ID_Dominios" = "3001. Dominios"."ID_Dominios" AND "3001. Dominios do Paciente"."Data" = "Datas do Diagnostico"."Data" AND "3001. Dominios do Paciente"."IDAnamnese" = "Datas do Diagnostico"."IDAnamnese")