SnowFlake查询最近7天内是否存在ID [英] SnowFlake Query if an Id exists on each of the last 7 days
本文介绍了SnowFlake查询最近7天内是否存在ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们每天将新记录插入到具有ID和created_on列的表中.
We INSERT new records every day to a table with say id and created_on column.
如何确定过去7天内每天是否存在具有特定标识符的记录?
How do i identify if records with a particular identifier existed every day in the last 7 days ?
推荐答案
我是通过以下查询完成的
I did it with the below query
select id, sum(present) as total_count
from
(select id,feed_date, count(1) as present
from catalog_rca
where feed_date between '2019-11-19' and '2019-11-25'
group by 1,2) as temp
group by 1 having total_count = 7;
这篇关于SnowFlake查询最近7天内是否存在ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文