【发布时间】:2019-02-25 14:41:43
【问题描述】:
我在雪花数据库上运行这个查询:
UPDATE "click" c
SET "Registration_score" =
(SELECT COUNT(*) FROM "trackingpoint" t
WHERE 1=1
AND c."CookieID" = t."CookieID"
AND t."page" ilike '%Registration complete'
AND TIMEDIFF(minute,c."Timestamp",t."Timestamp") < 4320
AND TIMEDIFF(second,c."Timestamp",t."Timestamp") > 0);
数据库返回Unsupported subquery type cannot be evaluated。但是,如果我在没有最后两个条件的情况下运行它(使用 TIMEDIFF),它就可以正常工作。我确认这些查询的实际 TIMEDIFF 语句没有问题:
select count(*) from "trackingpoint"
where TIMEDIFF(minute, '2018-01-01', "Timestamp") > 604233;
select count(*) from "click"
where TIMEDIFF(minute, '2018-01-01', "Timestamp") > 604233;
这些工作没有问题。我看不出 TIMEDIFF 条件应该阻止数据库返回结果的原因。知道我应该改变什么才能让它工作吗?
【问题讨论】:
-
一定是一些奇怪的数据问题 - Snowflake 的 Darren Gardner 在这里帮助了我:community.snowflake.com/s/question/0D50Z00008uhDktSAE/…
标签: sql sql-update correlated-subquery snowflake-cloud-data-platform