我正在运行一个查询,该查询提供一组不重叠的 first_party_id - 与一个第三方关联但与另一个无关的 ID。但是,此查询不在 Athena 中运行,并给出错误:Correlated queries not yet supported.
正在查看 prestodb 文档, https ://prestodb.io/docs/current/sql/select.html(Athena 是 prestodb 的底层),以寻找嵌套查询的替代方案。给出的 with statement
例子似乎不能很好地翻译这个not in
子句。想知道嵌套查询的替代方法是什么——下面的查询。
SELECT
COUNT(DISTINCT i.third_party_id) AS uniques
FROM
db.ids i
WHERE
i.third_party_type = 'cookie_1'
AND i.first_party_id NOT IN (
SELECT
i.first_party_id
WHERE
i.third_party_id = 'cookie_2'
)