UNION WHERE

Posted rsapaper

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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的主要内容,如果未能解决你的问题,请参考以下文章

使用 UNION 在 VIEW 中级联 WHERE 子句

Laravel UNION ALL 不适用于 where 语句

是否可以在 Union All BigQuery SQL 中让 where 子句引用另一个 where 子句?

WHERE 子句中的优化似乎不适用于 UNION

MySQL — SQL 语法错误(WHERE IN UNION)

SQL Server:如何将 UNION 与两个都有 WHERE 子句的查询一起使用?