首页 > 代码库 > UNION WHERE

UNION WHERE

w条件语句的作用域。

 1 SELECT
 2     *
 3 FROM
 4     (
 5         SELECT
 6             asin,
 7             LOWER(country) AS country
 8         FROM
 9             grab_amzreviews_asins
10         UNION DISTINCT 
11             SELECT
12                 asin,
13                 LOWER(country) AS country
14             FROM
15                 grab_amzsimilar_seller_asins
16             UNION DISTINCT 
17                 SELECT
18                     asin,
19                     LOWER(country) AS country
20                 FROM
21                     grab_amzlisting
22     ) AS w
23 WHERE
24     CONCAT(asin, country) NOT IN (
25         SELECT
26             CONCAT(asin, LOWER(country))
27         FROM
28             minerasinlist
29     ) ;

 

 

 1 SELECT
 2     asin,
 3     country
 4 FROM
 5     grab_amzreviews_asins
 6 UNION DISTINCT 
 7 SELECT
 8         asin,
 9         country
10     FROM
11         grab_amzsimilar_seller_asins
12     UNION DISTINCT 
13 SELECT
14             asin,
15             country
16         FROM
17             grab_amzlisting
18 WHERE
19             CONCAT(asin, LOWER(country)) NOT IN (
20                 SELECT
21                     CONCAT(asin, LOWER(country))
22                 FROM
23                     amzasin
24             );        

 

UNION WHERE