我有两个db2表,表一包含一行常量数据,其中id为列之一。第二个表包含id列,它是第一个表中id列的外键,还有3个varchar列。
我正在尝试将行插入第二个表,其中id col的输入基于where子句,其余列从外部获取值。
table1 has columns id, t1c1, t1c2, t1c3
table2 has columns id, t2c1, t2c2, t2c3
要插入到table2中,我正在尝试此查询:
insert into table2 values
(select id from table1 where t1c2 like 'xxx', 'abc1','abc2');
我知道这是我在这里缺少的基本知识。 请帮助纠正此查询。