当我从子选择中选择并最终想要对结果进行"不在"时,BQ查询会给出以下错误:
Error: Join attribute is not defined: t1.customer_id
当我用一个简单where t1.customer_id = 1的例子更改"not in"部分时,查询将执行.
查询看起来不像是一个连接,但是从错误中,BigQuery似乎认为它是.
select t1.customer_id , GROUP_CONCAT(t1.id) from (
select customer.id as customer_id, id
from (TABLE_QUERY(redacted , 'table_id in ( "x_201502", "x_201503")'))
where created >= '2014-09-05 00:00:00'
and created < '2015-03-04 00:00:00'
group by customer_id, id
) t1
where t1.customer_id not in (
select customer.id as customer_id
from (TABLE_QUERY(redacted , 'table_id in ("y_201503")'))
where created >= '2015-03-03 18:55:59'
group by customer_id
)
group by t1.customer_id;
Run Code Online (Sandbox Code Playgroud)
我最初试图在子选择中放入"not in"子选择,但BQ也为该方法投掷了错误,因此我尝试了这个构造.请注意,当跟随2个子选择的连接时,"not in"部分确实有效.
关于如何在这种特殊情况下完成"不进行"检查的任何想法?
| 归档时间: |
|
| 查看次数: |
693 次 |
| 最近记录: |