我有table1和table2。我想将table1中的列a和列b插入到table2和我自己的值(value1和value2)中。列a和b非常大,这就是为什么我不想将它们导入我的java应用程序。另外我需要a和b选择的where条件。我的preparedStatement应该怎么样?我认为如下:
insert into table2 (columnvalue1, columnvalue2, a, b) as
(select a, b from table1 where value3 = ? and value4 = ?)
答案 0 :(得分:1)
类似的东西:
insert into table2 (columnforvalue1, columnforvalue2, a, b)
select value1, value2, a, b from table1 where value3 = ? and value4 = ?
或者
insert into table2 (columnforvalue1, columnforvalue2, a, b)
select ?, ?, a, b from table1 where value3 = ? and value4 = ?