insert into newTable
select one.col1 as first, two.col2 as second
from thing1 as one inner join thing2 as two
on SOMETHING
where SOMETHING
我正在尝试插入上面的newTable。但是,我真正想做的是
insert into newTable
select one.col1 as first, two.col2 + 1 as second
from thing1 as one inner join thing2 as two
on SOMETHING
where SOMETHING
意思是我想在插入newTable之前更改第二列(加一)。
我如何在Sqlite中执行此操作?
1)。创建并命名临时表,递增1(更新表),然后将结果插入newTable? (怎么样?) 要么 2)。是直接/尽可能简洁吗?
我试过了:
insert into newTable
update(
select one.col1 as first, two.col2 as second
from thing1 as one inner join thing2 as two
on SOMETHING
where SOMETHING
)set second = second + 1
这不起作用。我可以做类似的事情吗?