Import CSV to Update only one column in table

前端 未结 3 1632
忘了有多久
忘了有多久 2020-11-30 17:38

I have a table that looks like this:

products
--------
id, product, sku, department, quantity

There are approximately 800,000 entries in th

3条回答
  •  借酒劲吻你
    2020-11-30 18:20

    I would load the update data into a seperate table UPDATE_TABLE and perform an update within MySQL using:

    UPDATE PRODUCTS P SET P.QUANTITY=(
        SELECT UPDATE_QUANTITY
        FROM UPDATE_TABLE
        WHERE UPDATE_PRODUCT=P.PRODUCT
    )
    

    I dont have a MySQL at hand right now, so I can check the syntax perfectly, it might be you need to add a LIMIT 0,1 to the inner SELECT.

提交回复
热议问题