mysql根据查询结果批量更新多条数据(插入或更新) 1.1 前言 mysql根据查询结果执行批量更新或插入时经常会遇到1093的错误问题.基本上批量插入或新增都会涉及到子查询,mysql是建议不要对需要操作的表放入子查询条件中的,因此我们尽量避免子查询中涉及到需要操作的表,如果无法避免,则可以考虑用连接查询的方式进行. ERROR 1093 (HY000): You can't specify target table 'dir' for update in FROM clause 1.2 根…
7 插入.更新与删除数据 7.1 插入数据 先创建表person: create table person( id int not null, name char(40) not null default '', age int not null default 0, info char(50) null, primary key(id) ); 7.1.1 为表的所有字段插入数据 insert into 表名 (属性1,属性2,...) values(值1,值2,...) [,(值1,值2,..…