Mysql
 sql >> Database >  >> RDS >> Mysql

AGGIORNAMENTO SQL con sottoquery che fa riferimento alla stessa tabella in MySQL

Qualche riferimento per te http://dev.mysql.com/doc /refman/5.0/en/update.html

UPDATE user_account student 
INNER JOIN user_account teacher ON
   teacher.user_account_id = student.teacher_id 
   AND teacher.user_type = 'ROLE_TEACHER'
SET student.student_education_facility_id = teacher.education_facility_id