skip to Main Content

Calculate cumulative distinct – Postgresql

I have on the datebase a table containing: created_at order_id customer_id I want to calculate the cumulative distinct number of customers per day. I wrote this query SELECT created_at::date, COUNT(DISTINCT customer_id) OVER (ORDER BY created_at::date) as cumulative_users FROM orders GROUP…

VIEW QUESTION
Back To Top
Search