mysql 关联(查询)更新 查询插入

599 阅读1分钟
关联更新:

update

    table a,

    table b

set

    a.field1 = b.field1,

    a.field2 = b.field2

where

    a.f = b.f  。。。

备注:table b可以是某实体表, 也可以是select 查询出来的表


批量插入:

insert into t1(col1, col2, col3)select c1,c2,c3 from t2 where 。。。。