gpt4 book ai didi

google-analytics - 使用 IN ( ) 进行子查询时使用多个字段

转载 作者:行者123 更新时间:2023-12-03 07:21:43 26 4
gpt4 key购买 nike

在 Google BigQuery 中,我必须执行以下操作:

SELECT hits.item.productName
FROM [‘Dataset Name’ ]
WHERE date, visitId, fullVisitorId IN (
SELECT date, visitId, fullVisitorId
FROM [‘Dataset Name’ ]
WHERE hits.item.productName CONTAINS 'Product Item Name A'
AND totals.transactions>=1)

但是,这似乎不受支持。除了使用 JOIN 之外,我还有什么选择?

最佳答案

改为加入 JOIN。

相当于:

SELECT COUNT(*), stn, a.wban, FIRST(name) name, FIRST(country) country
FROM [fh-bigquery:weather_gsod.gsod2014] a
WHERE stn, wban IN
(SELECT usaf, wban FROM [fh-bigquery:weather_gsod.stations] WHERE country='UK')
GROUP BY 2, 3
ORDER BY 1 DESC

将是:

SELECT COUNT(*), stn, a.wban, FIRST(name) name, FIRST(country) country
FROM [fh-bigquery:weather_gsod.gsod2014] a
JOIN [fh-bigquery:weather_gsod.stations] b
ON a.stn=b.usaf AND a.wban=b.wban
WHERE country='UK'
GROUP BY 2, 3
ORDER BY 1 DESC

关于google-analytics - 使用 IN ( ) 进行子查询时使用多个字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30987796/

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