mysql a table in the field of qualified update to another table

If B To field in the table to update Table A

Statement:
. Update Library name table A
Inner the Join (SELECT column a, column b from Table B) C
. ON = c A. Column name column names
set A. Column Name column name = c;.

举例:
update DB.rank inner join(select school_id,ch_name from school) c
on rank.school_name = c.ch_name
set rank.school_id = c.school_id;

Published 143 original articles · won praise 45 · views 70000 +

Guess you like

Origin blog.csdn.net/z714405489/article/details/90304955