我正在尝试为表中的每个ID做不同的日期计数。我尝试了此代码,但未返回正确的输出。
SELECT *
, DENSE_RANK() OVER(PARTITION BY "video_id" ORDER BY "date") AS "distinct_count_date"
FROM mytable
;
答案 0 :(得分:2)
也许您需要:
select video_id, count(distinct date)
from mytable
group by video_id;