Skip to content

Instantly share code, notes, and snippets.

@dotku
Last active August 4, 2017 05:23
Show Gist options
  • Select an option

  • Save dotku/f85df461e6071e6a5562fd722a0f6e48 to your computer and use it in GitHub Desktop.

Select an option

Save dotku/f85df461e6071e6a5562fd722a0f6e48 to your computer and use it in GitHub Desktop.
  1. 更新图片
Update tp_goods Set original_img = concat('/Public/upload/goods/2016/', goods_sn, '/main/1.jpg');
  1. 更新商品编号
Update tp_goods Set goods_sn = 28	where goods_name like "%Aptamil 英国爱他美 婴儿奶粉 1段 900克 0-6个月适用%"
  1. 第三级别数据删除
DELETE FROM `tp_article_cat` WHERE cat_id in (
  SELECT * FROM (
    SELECT cat_id FROM `tp_article_cat` WHERE parent_id = 76
  ) as TB
)
  1. 第三级 与 第二级 分类删除
DELETE FROM `tp_article_cat`
WHERE parent_id in (
  SELECT * FROM ((
      SELECT cat_id FROM `tp_article_cat` WHERE parent_id in (
          SELECT cat_id FROM `tp_article_cat` WHERE cat_name like '%tpshop%'
      ) 
      OR cat_name like '%tpshop%'
  ) as TA )
)
OR parent_id in (
  SELECT * FROM ((
      SELECT cat_id FROM `tp_article_cat` WHERE cat_name like '%tpshop%'
  ) as TB)
)
  1. 产品入库
INSERT INTO `tp_goods` (goods_sn, goods_name, original_img, shop_price, cost_price, cat_id, brand_id)
VALUES ("290543TQ",'Birthday Blooms Stud Earrings, December, Turquoise', "/public/upload/goods/2017/07-17/290543TQ.jpg",502.50,455.60,849,357);
  1. 产品添加关键字
UPDATE `tp_goods` SET keywords = CONCAT(keywords, " 日本") WHERE `goods_id` >= 1579
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment