lundi 29 février 2016

Update a column with anothers table's column [duplicate]

This question already has an answer here:

I have table EMPLOYEES (surname, name, id, email) and TEMP(surname, name, email) and I want to update the EMPLOYEES.mail with the TEMP.email. I tried this, but I get an error

UPDATE EMPLOYEES
SET email = ( SELECT TEMP.surname , TEMP.name , TEMP.email , EMPLOYEES.email, EMPLOYEES.surname , EMPLOYEES.name
              FROM EMPLOYEES, TEMP
              WHERE (TEMP.surname = EMPLOYEES.surname AND TEMP.name = EMPLOYEES.name)
            )

but I get this error [ only a single result allowed for a SELECT that is part of an expression ]

Aucun commentaire:

Enregistrer un commentaire