按照list的数据结构和规则新建表newlist 然后运行update newlist a,log b set a.iscloseobstrid=b.newobstrid where a.iscloseobstrid=b.obstrid即可(log的obstrid唯一)
INSERT ??插入到一个新表中???INSERT INTO tA ... SELECT ....FROM tB,tC WHERE ... 或 CREATE TABLE tA ... SELECT ....FROM tB,tC WHERE ...
第一次用 create table newlist select a.iscloseid,a.isclosetime,a.userid,b.newobstrid as iscloseobstrid,a.lingdan from list a,log b where a.iscloseobstrid=b.obstrid以后更新insert into newlist select a.iscloseid,a.isclosetime,a.userid,b.newobstrid as iscloseobstrid,a.lingdan from list a,log b where a.iscloseobstrid=b.obstrid
然后运行update newlist a,log b set a.iscloseobstrid=b.newobstrid where a.iscloseobstrid=b.obstrid即可(log的obstrid唯一)
或
CREATE TABLE tA ... SELECT ....FROM tB,tC WHERE ...
create table newlist
select a.iscloseid,a.isclosetime,a.userid,b.newobstrid as iscloseobstrid,a.lingdan
from list a,log b
where a.iscloseobstrid=b.obstrid以后更新insert into newlist
select a.iscloseid,a.isclosetime,a.userid,b.newobstrid as iscloseobstrid,a.lingdan
from list a,log b
where a.iscloseobstrid=b.obstrid