[英]MYSQL insert into table select id as NULL, * from temp_tbl
I would like to select everything from a temporary table then set the id of the result to NULL so that I can insert this record to a table like below: 我想从临时表中选择所有内容,然后将结果的ID设置为NULL,以便可以将此记录插入如下表中:
insert into product select NULL as id, * from tmp_tb
But this query does not work. 但是此查询不起作用。 Please give me an idea how to do this correctly.
请给我一个想法,如何正确地做到这一点。 Thanks in advance!
提前致谢!
尝试这个 ;)
INSERT INTO product SELECT NULL, tmp_tb.* FROM tmp_tb;
尝试这个:
insert into product select NULL, col2, col3, ..., colN from tmp_tb
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.