SELECT ymd,
creative_id,
sum(imps) as imps,
sum(booked_revenue_dollars) as booked_rev
FROM agg_dw_advertiser_publisher_analytics_adjusted
WHERE buyer_member_id=456
AND (sum(imps) > 500 WHERE ymd > current_date() - 14) #this part is wrong
GROUP BY 1,2
HAVING min(ymd) < current_date() - 14
ORDER BY 2,1 ASC;
ymd = 年/月/日
我试图过滤掉过去 2 周内creative_id
字段总和imps
小于 500 的 's 。我显然做的不对,但我尝试过作为附加HAVING
子句和子查询。我究竟做错了什么?