码迷,mamicode.com
首页 > 其他好文 > 详细

UNION WHERE

时间:2017-01-23 15:16:44      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:views   count   blog   lis   div   rom   条件语句   view   union   

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

标签:views   count   blog   lis   div   rom   条件语句   view   union   

原文地址:http://www.cnblogs.com/yuanjiangw/p/6344008.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!