插入具有不同值的同一张表

时间:2019-01-28 17:44:29

标签: sql sqlite

INSERT INTO list
SELECT * FROM list
WHERE server = '535566701375389706'

我如何复制/粘贴上述所有行,但是将ID更改为其他ID? (使用SQLITE)

1 个答案:

答案 0 :(得分:0)

很远

create table tmp as
  select * from list 
    where server = '535566701375389706';

update tmp set id = 1234;

insert into list
   select * from tmp;

drop table tmp;

或者,

insert into list
  select 1234, col1, col2, .. colN 
  from list