db2 query insert from another table

后端 未结 4 538
我在风中等你
我在风中等你 2021-01-12 15:22

I have a table product(id_product , name );

I have another one: productHistory (id_H , id_product , name);

I wanna create a query (db2) to insert all the row

4条回答
  •  长情又很酷
    2021-01-12 16:00

    INSERT INTO productHistory (id_h, id_product, name)
      (SELECT
        product_history_seq.nextval,
        id_product,
        name
      FROM product);
    

    That works

提交回复
热议问题