MYSQL associates two or more tables to perform modify and delete operations



Two-table connection modification

update t1, t2 set t2.address_detail='test'
where t2.user_id=t1.user_id and t1.open_id='12';

there are parameters of t1 table to modify the field value of t2


two- table connection delete

delete t1 from t2 ,t1 where t1.user_id = t2.user_id;

execute to delete two or more associated tables. Of course, two tables need to have a primary and foreign key relationship





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326476314&siteId=291194637