magento 采集数据处理sql 初稿

DROP TABLE IF EXISTS export_magento;

CREATE TABLE export_magento(
  store               VARCHAR(30)     NOT NULL
  ,websites            VARCHAR(30)     NOT NULL
  ,attribute_set       VARCHAR(30)     NOT NULL
  ,type              VARCHAR(30)     NOT NULL
  ,sku                 VARCHAR(50)     NOT NULL
  ,name              VARCHAR(512)    NOT NULL
  ,product_name        VARCHAR(512)    NOT NULL
  ,price               VARCHAR(50)    NOT NULL
  ,special_price       VARCHAR(50)   NULL
  ,weight              VARCHAR(30)     NOT NULL DEFAULT ''
  ,short_description   VARCHAR(1000)   NOT NULL DEFAULT ''
  ,description         TEXT            NOT NULL
  ,meta_title          VARCHAR(512)    NOT NULL DEFAULT ''
  ,meta_keyword        VARCHAR(512)    NOT NULL DEFAULT ''
  ,meta_description    VARCHAR(2000)   NOT NULL DEFAULT ''
  ,image               VARCHAR(255)    NOT NULL DEFAULT ''
  ,small_image         VARCHAR(255)    NOT NULL DEFAULT ''
  ,thumbnail           VARCHAR(255)    NOT NULL DEFAULT ''
  ,gallery             VARCHAR(512)    NOT NULL DEFAULT ''
  ,status             VARCHAR(10)     NOT NULL DEFAULT 'Enabled'
  ,tax_class_id        VARCHAR(10)     NOT NULL DEFAULT 'None'
  ,qty                 INT             NOT NULL DEFAULT 0
  ,category_ids        VARCHAR(50)     NOT NULL DEFAULT ''
  ,is_in_stock         TINYINT         NOT NULL DEFAULT 1
  ,visibility          VARCHAR(30)     NOT NULL DEFAULT ''
);

delete from export_magento where store='store';
delete from export_magento where image='';
update export_magento set short_description=replace(short_description,'?',' ');
update export_magento set meta_description=replace(meta_description,'?',' ');
update export_magento set price=replace(price,'$','');
update export_magento set special_price=replace(special_price,'$','');
update export_magento set visibility='Catalog, Search';
update export_magento set attribute_set='Electronics';
update export_magento set image=replace(image,'/','/E/psp2000/');
update export_magento set small_image=replace(small_image,'/','/E/psp2000/');
update export_magento set thumbnail=replace(thumbnail,'/','/E/psp2000/');
update export_magento set gallery=replace(gallery,'/','/E/psp2000/');
update export_magento set category_ids='2,3';

select LOCATE('src="',image,6) from export_magento;
select LOCATE('">',image) from export_magento;
select SUBSTRING(image,LOCATE('src="',image)+5,LOCATE('">',image)-LOCATE('src="',image)-5) from export_magento;

                  
/*INSERT INTO export_magento_temp
SELECT p.entity_id AS entity_id
      ,'admin' AS store
      ,'base' AS websites
      ,'Default' AS attribute_set
      ,'simple' AS TYPE
      ,p.sku AS sku
      ,p.name AS NAME
      ,p.name AS product_name
      ,p.price AS price
      ,p.special_price  AS special_price
      ,p.weight  AS weight
      ,p.short_description AS short_description
      ,'' AS description
      ,p.name AS meta_title
      ,'' AS meta_keyword
      ,'' AS meta_description
      ,'' AS image
      ,p.small_image AS small_image
      ,p.thumbnail AS thumbnail
      ,'' AS gallery
      ,'Enabled' AS STATUS
      ,'None' AS tax_class_id
      ,1000 AS qty
      ,'2' AS category_ids
      ,1 AS is_in_stock
      ,'Catalog, Search' AS visibility
  FROM catalog_product_flat_1 p;*/
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值