Actualización de la columna 1 en la tabla 1 solo si coincide con la columna 3 en la tabla 2

I want to update column1 in table1 only if the column2 in table1 match the column3 in table2.

I am trying to do using this query but I got an error that says that I am missing equal sign.

Can anyone can help?

update schema1.table1 
set schema1.table1.column1
where schema1.table1.column2 = table2.column1

preguntado el 12 de febrero de 14 a las 06:02

3 Respuestas

Your error says it all. You are not assigning any value to the column. Try to set the value using the equal = firmar

Puedes probar esto:

update schema1.table1 
set schema1.table1.column1 = //The value which you want to store
where schema1.table1.column2 = table2.column1

Respondido 12 Oct 21, 20:10

Prueba esta consulta:

update schema1.table1 t1 
set t1.column1 = (select t2.columnX from table2 t2
                  where t1.column2 = t2.column1)
where t1.column2 in (select column1 from table2)

Respondido 12 Oct 21, 20:10

As in the error message, you have missed an = and not assigning any value for schema1.table1.column1 en la consulta.

Intente así:

UPDATE schema1.table1 
SET    schema1.table1.column1 = <your_value>
WHERE  schema1.table1.column2 = table2.column1;

Respondido 12 Oct 21, 20:10

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.