【发布时间】:2019-03-06 19:28:14
【问题描述】:
我正在尝试将此插入运行到 select 语句中:
insert into xyz (select t1.column1, t1.column2 from table1 t1, table2 t2
where t1.column1 = t2.column1)
但得到错误:“分配的值的数量与指定或隐含的列或变量的数量不同”
我想将所有其他列设置为空(例如 t1.column3 到 t1.column50)。
有没有办法做到这一点,而不必在 select 语句中明确列出所有列?
insert into xyz (select t1.column1, t1.column2, null as column3, null as column4, null as
column5... from table1 t1, table2 t2
where t1.column1 = t2.column1)
【问题讨论】:
标签: sql select insert db2 dashdb