t

ALTER TABLE `t1` ADD COLUMN `bid` VARCHAR(32) NOT NULL DEFAULT '' AFTER `id`;

UPDATE t1 AS s SET s.bid=(SELECT bid FROM t2 AS w WHERE w.id=s.id );

 

 UPDATE t1 AS s SET s.bid=( IF((SELECT bid FROM t2 AS w WHERE w.id=s.id) IS NULL,"", (SELECT bid FROM t2 AS w WHERE w.id=s.id)));

 

posted @ 2021-04-02 09:26  papering  阅读(137)  评论(0编辑  收藏  举报