插入新副本时如何从表中删除副本?

时间:2019-04-23 15:36:14

标签: mysql

UPDATE  vw_childoptions 
SET (entity_id,sku,upc,optionlabel,childoptions,qty) 
select `vw_childoptions_index`.`entity_id` AS `entity_id`,
    `vw_childoptions_index`.`sku` AS `sku`,`vw_childoptions_index`.`upc` AS `upc`,
    `vw_childoptions_index`.`optionlabel` AS `optionlabel`,
    `vw_childoptions_index`.`childoptions` AS `childoptions`,
    `vw_childoptions_index`.`qty` AS `qty`
from `vw_childoptions_index`; 

通过此查询,我正在添加新选项,但是有一个问题,在每次调用(更新)时插入例如S-size时,S-size会再次出现。所以我想从表中删除重复项,因为我在mysql查询中很虚弱,所以如果您不介意的话,只为该表编写查询即可。

已更新

对不起查询是这样

INSERT INTO IGNORE vw_childoptions 
SET (entity_id,sku,upc,optionlabel,childoptions,qty) 
select vw_childoptions_index.entity_id AS entity_id,
    vw_childoptions_index.sku AS sku,vw_childoptions_index.upc AS upc,
    vw_childoptions_index.optionlabel AS optionlabel,
    vw_childoptions_index.childoptions AS childoptions,
    vw_childoptions_index.qty AS qty 
from vw_childoptions_index;

0 个答案:

没有答案