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;