gpt4 book ai didi

sql - 在 select 语句中插入多个值的值

转载 作者:搜寻专家 更新时间:2023-10-30 20:01:37 24 4
gpt4 key购买 nike

我尝试将 1 列插入到表中(从表中选择)。

我应该将所有 id 复制到 table1,其中 1 列是(从表中选择)

这不起作用:

insert into table1 (id,resoucrce,rate)  values ((select id from table2),0,0)

我想做一些类似的事情,将表中的所有 id 插入到另一个具有默认值的表中。

最佳答案

使用插入。 . .选择:

 insert into table1 (id, resource, rate) 
select id, 0, 0
from table2;

关于sql - 在 select 语句中插入多个值的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33804409/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com