• UNION DISTINCT


    w同结构表读写合并。

      1 DROP PROCEDURE IF EXISTS w_ww_amzasin;
      2 DELIMITER /w/
      3 CREATE PROCEDURE w_ww_amzasin()
      4 BEGIN
      5   DECLARE done INT DEFAULT FALSE;
      6   DECLARE w_asin VARCHAR(16);
      7   DECLARE w_country VARCHAR(6);
      8   DECLARE wcur CURSOR FOR
      9                         SELECT asin,country FROM grab_amzreviews_asins
     10                                 UNION DISTINCT
     11                         SELECT asin,country FROM grab_amzsimilar_seller_asins
     12                                 UNION DISTINCT
     13                         SELECT asin,country FROM grab_amzlisting
     14                                 WHERE CONCAT(asin,LOWER(country)) NOT IN
     15                                     (SELECT CONCAT(asin,LOWER(country)) FROM amzasin) ;
     16   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
     17 
     18   OPEN wcur;
     19   read_loop: LOOP
     20     FETCH wcur INTO w_asin,w_country;
     21     IF done THEN LEAVE read_loop;
     22     END IF;
     23         SET @w_nothhtps='www.amazon.';  
     24         SET @w_most=CONCAT(LOWER(w_country),'/product/dp/',w_asin);
     25         CASE  LOWER(w_country)
     26                 WHEN 'ca' THEN SELECT 'w';
     27                 WHEN 'in' THEN SELECT 'w';
     28                 WHEN 'es' THEN SELECT 'w';
     29                 WHEN 'it' THEN SELECT 'w';
     30                 WHEN 'fr' THEN SELECT 'w';
     31 
     32                 WHEN 'jp' THEN SET @w_most=CONCAT('co.',@w_most);
     33                 WHEN 'uk' THEN SET @w_most=CONCAT('co.',@w_most);
     34 
     35                 WHEN 'mx' THEN SET @w_most=CONCAT('com.',@w_most);
     36 
     37                 WHEN 'us' THEN SET @w_most=CONCAT('com/gp/product/',w_asin);
     38       ELSE
     39         BEGIN
     40         END;
     41     END CASE;
     42 
     43         SET @w_nothhtps=CONCAT(@w_nothhtps,@w_most);
     44         SET @wtmp = CONCAT('INSERT INTO  amzasin (asin,country,url) VALUES ( "',w_asin,'","',w_country,'","',@w_nothhtps,'")');
     45         PREPARE  stmt FROM @wtmp ;
     46         EXECUTE  stmt ;
     47         DROP PREPARE stmt;
     48   END LOOP;
     49   CLOSE wcur;
     50 END/w/
     51 DELIMITER;
     52 CALL w_ww_amzasin( );
     53 
     54 
     55 
     56 DROP PROCEDURE IF EXISTS w_ww_amzasin;
     57 DELIMITER /w/
     58 CREATE PROCEDURE w_ww_amzasin()
     59 BEGIN
     60   DECLARE done INT DEFAULT FALSE;
     61   DECLARE w_asin VARCHAR(16);
     62   DECLARE w_country VARCHAR(6);
     63   DECLARE wcur CURSOR FOR SELECT asin,country FROM grab_amzlisting WHERE CONCAT(asin,LOWER(country)) NOT IN (SELECT CONCAT(asin,LOWER(country)) FROM amzasin );
     64   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
     65 
     66   OPEN wcur;
     67   read_loop: LOOP
     68     FETCH wcur INTO w_asin,w_country;
     69     IF done THEN LEAVE read_loop;
     70     END IF;
     71         SET @w_nothhtps='www.amazon.';  
     72         SET @w_most=CONCAT(LOWER(w_country),'/product/dp/',w_asin);
     73         CASE  LOWER(w_country)
     74                 WHEN 'ca' THEN SELECT 'w';
     75                 WHEN 'in' THEN SELECT 'w';
     76                 WHEN 'es' THEN SELECT 'w';
     77                 WHEN 'it' THEN SELECT 'w';
     78                 WHEN 'fr' THEN SELECT 'w';
     79 
     80                 WHEN 'jp' THEN SET @w_most=CONCAT('co.',@w_most);
     81                 WHEN 'uk' THEN SET @w_most=CONCAT('co.',@w_most);
     82 
     83                 WHEN 'mx' THEN SET @w_most=CONCAT('com.',@w_most);
     84 
     85                 WHEN 'us' THEN SET @w_most=CONCAT('com/gp/product/',w_asin);
     86       ELSE
     87         BEGIN
     88         END;
     89     END CASE;
     90 
     91         SET @w_nothhtps=CONCAT(@w_nothhtps,@w_most);
     92         SET @wtmp = CONCAT('INSERT INTO  amzasin (asin,country,url) VALUES ( "',w_asin,'","',w_country,'","',@w_nothhtps,'")');
     93         PREPARE  stmt FROM @wtmp ;
     94         EXECUTE  stmt ;
     95         DROP PREPARE stmt;
     96   END LOOP;
     97   CLOSE wcur;
     98 END/w/
     99 DELIMITER;
    100 CALL w_ww_amzasin( );
    101 
    102 DROP PROCEDURE IF EXISTS w_ww_amzasin;
    103 DELIMITER /w/
    104 CREATE PROCEDURE w_ww_amzasin()
    105 BEGIN
    106   DECLARE done INT DEFAULT FALSE;
    107   DECLARE w_asin VARCHAR(16);
    108   DECLARE w_country VARCHAR(6);
    109   DECLARE wcur CURSOR FOR SELECT asin,country FROM grab_amzsimilar_seller_asins WHERE CONCAT(asin,LOWER(country)) NOT IN (SELECT CONCAT(asin,LOWER(country)) FROM amzasin );
    110   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
    111 
    112   OPEN wcur;
    113   read_loop: LOOP
    114     FETCH wcur INTO w_asin,w_country;
    115     IF done THEN LEAVE read_loop;
    116     END IF;
    117         SET @w_nothhtps='www.amazon.';  
    118         SET @w_most=CONCAT(LOWER(w_country),'/product/dp/',w_asin);
    119         CASE  LOWER(w_country)
    120                 WHEN 'ca' THEN SELECT 'w';
    121                 WHEN 'in' THEN SELECT 'w';
    122                 WHEN 'es' THEN SELECT 'w';
    123                 WHEN 'it' THEN SELECT 'w';
    124                 WHEN 'fr' THEN SELECT 'w';
    125 
    126                 WHEN 'jp' THEN SET @w_most=CONCAT('co.',@w_most);
    127                 WHEN 'uk' THEN SET @w_most=CONCAT('co.',@w_most);
    128 
    129                 WHEN 'mx' THEN SET @w_most=CONCAT('com.',@w_most);
    130 
    131                 WHEN 'us' THEN SET @w_most=CONCAT('com/gp/product/',w_asin);
    132       ELSE
    133         BEGIN
    134         END;
    135     END CASE;
    136 
    137         SET @w_nothhtps=CONCAT(@w_nothhtps,@w_most);
    138         SET @wtmp = CONCAT('INSERT INTO  amzasin (asin,country,url) VALUES ( "',w_asin,'","',w_country,'","',@w_nothhtps,'")');
    139         PREPARE  stmt FROM @wtmp ;
    140         EXECUTE  stmt ;
    141         DROP PREPARE stmt;
    142   END LOOP;
    143   CLOSE wcur;
    144 END/w/
    145 DELIMITER;
    146 CALL w_ww_amzasin( );
    147 
    148 DROP PROCEDURE IF EXISTS w_ww_amzasin;
    149 DELIMITER /w/
    150 CREATE PROCEDURE w_ww_amzasin()
    151 BEGIN
    152   DECLARE done INT DEFAULT FALSE;
    153   DECLARE w_asin VARCHAR(16);
    154   DECLARE w_country VARCHAR(6);
    155   DECLARE wcur CURSOR FOR SELECT asin,country FROM grab_amzreviews_asins WHERE CONCAT(asin,LOWER(country)) NOT IN (SELECT CONCAT(asin,LOWER(country)) FROM amzasin );
    156   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
    157 
    158   OPEN wcur;
    159   read_loop: LOOP
    160     FETCH wcur INTO w_asin,w_country;
    161     IF done THEN LEAVE read_loop;
    162     END IF;
    163         SET @w_nothhtps='www.amazon.';  
    164         SET @w_most=CONCAT(LOWER(w_country),'/product/dp/',w_asin);
    165         CASE  LOWER(w_country)
    166                 WHEN 'ca' THEN SELECT 'w';
    167                 WHEN 'in' THEN SELECT 'w';
    168                 WHEN 'es' THEN SELECT 'w';
    169                 WHEN 'it' THEN SELECT 'w';
    170                 WHEN 'fr' THEN SELECT 'w';
    171 
    172                 WHEN 'jp' THEN SET @w_most=CONCAT('co.',@w_most);
    173                 WHEN 'uk' THEN SET @w_most=CONCAT('co.',@w_most);
    174 
    175                 WHEN 'mx' THEN SET @w_most=CONCAT('com.',@w_most);
    176 
    177                 WHEN 'us' THEN SET @w_most=CONCAT('com/gp/product/',w_asin);
    178       ELSE
    179         BEGIN
    180         END;
    181     END CASE;
    182 
    183         SET @w_nothhtps=CONCAT(@w_nothhtps,@w_most);
    184         SET @wtmp = CONCAT('INSERT INTO  amzasin (asin,country,url) VALUES ( "',w_asin,'","',w_country,'","',@w_nothhtps,'")');
    185         PREPARE  stmt FROM @wtmp ;
    186         EXECUTE  stmt ;
    187         DROP PREPARE stmt;
    188   END LOOP;
    189   CLOSE wcur;
    190 END/w/
    191 DELIMITER;
    192 CALL w_ww_amzasin( );
    193 
    194 
    195 
    196 
    197  
    198  
  • 相关阅读:
    微支付开发(.net)
    微信公众平台开发(一) 配置接口
    [040] 微信公众帐号开发教程第16篇-应用实例之历史上的今天
    [039] 微信公众帐号开发教程第15篇-自定义菜单的view类型(访问网页)
    [038] 微信公众帐号开发教程第14篇-自定义菜单的创建及菜单事件响应
    [037] 微信公众帐号开发教程第13篇-图文消息全攻略
    【微网站开发】之微信内置浏览器API使用
    .Net(c#)汉字和Unicode编码互相转换
    jquery.uploadify上传文件配置详解(asp.net mvc)
    微信公众平台入门开发教程.Net(C#)框架
  • 原文地址:https://www.cnblogs.com/rsapaper/p/6338130.html
Copyright © 2020-2023  润新知