报错如题:The query could not be executed in the allotted memory.
以下query, 需要在倒数第二行增加一个或者条件,使其变为:“WHERE ROW_COUNT = 2 or ROW_COUNT =1 and (DAYOFWEEK(SNAPSHOT_TIMESTAMP) = 7 or SNAPSHOT_TIMESTAMP = MAX_SNAPSHOT_DT))”
但是写完就报错如题:The query could not be executed in the allotted memory. 求解求解求解~
SELECT InputIMEI, InputCarrier, InputProgramName, InputStoreID, InputAddress, InputCity, InputState, InputZip, ActivationDate, LastLoginDate, DeviceStatus, ActiveDeviceCnt, DeviceMatchCnt, TotalIMEIs, TotalActivatedIMEI, LatestDeviceEventTime
, a.SNAPSHOT_TIMESTAMP as SNAPSHOT_TIMESTAMP, MAX(a.SNAPSHOT_TIMESTAMP) OVER () as MAX_SNAPSHOT_DT, b.SNAPSHOT_DATE as SNAPSHOT_DATE
FROM [] a
JOIN
((SELECT * FROM
(SELECT SNAPSHOT_TIMESTAMP
, DATE(SNAPSHOT_TIMESTAMP) as SNAPSHOT_DATE
, COUNT(SNAPSHOT_TIMESTAMP) OVER (PARTITION BY SNAPSHOT_DATE ORDER BY SNAPSHOT_TIMESTAMP) as ROW_COUNT
, MAX(SNAPSHOT_TIMESTAMP) OVER () as MAX_SNAPSHOT_DT
FROM []
WHERE DATE(SNAPSHOT_TIMESTAMP) >= '2019-03-01'
GROUP BY 1,2 order by 1 desc)
WHERE ROW_COUNT = 2 and (DAYOFWEEK(SNAPSHOT_TIMESTAMP) = 7 or SNAPSHOT_TIMESTAMP = MAX_SNAPSHOT_DT))
) b
ON a.SNAPSHOT_TIMESTAMP = b.SNAPSHOT_TIMESTAMP