gpt4 book ai didi

google-bigquery - 如何在BigQuery中使用EXISTS获取匹配过去日志的内容

转载 作者:行者123 更新时间:2023-12-02 20:50:01 25 4
gpt4 key购买 nike

我想知道。今天访问过的人过去访问过吗?人数。

SELECT
COUNT(user_id) AS repeater_user_count
FROM
[access_log] AS table1
WHERE
_PARTITIONTIME = TIMESTAMP('2017-02-28')
AND
EXISTS
(
SELECT
1
FROM
[access_log] AS table2
WHERE
_PARTITIONTIME BETWEEN TIMESTAMP('2017-01-31') AND TIMESTAMP('2017-02-27')
AND
table1.user_id = table2.user_id
)

但是,BigQuery UI 会发出错误。

Error: error at: 8.1 - 13.184. Only one query can be executed at a time.

如何通过 BigQuery 引用同一个表?

谢谢。

最佳答案

确保enable standard SQL第一的。例如,

#standardSQL
SELECT
COUNT(user_id) AS repeater_user_count
FROM
`access_log` AS table1
WHERE
_PARTITIONTIME = '2017-02-28'
AND
EXISTS
(
SELECT
1
FROM
`access_log` AS table2
WHERE
_PARTITIONTIME BETWEEN '2017-01-31' AND '2017-02-27'
AND
table1.user_id = table2.user_id
);

关于google-bigquery - 如何在BigQuery中使用EXISTS获取匹配过去日志的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42508893/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com