MySQL - insert data from another table merged with constants

后端 未结 1 645
臣服心动
臣服心动 2020-12-10 22:08

I have a temporary table (products_temp) with some data, and I have another table (products) I need to insert the data into. I have some constants I need to set manually on

相关标签:
1条回答
  • 2020-12-10 22:26

    Use an INSERT ... SELECT statement where you are selecting constant values as well as data from products_temp:

    INSERT INTO products (product_data, vendor_id)
        SELECT data, '1' FROM products_temp
    
    0 讨论(0)
提交回复
热议问题