On Mon, Jul 6, 2015 at 2:04 PM, Robert DiFalco <robert.difa...@gmail.com>
wrote:

> Wouldn't I have to generate a series based on the date range (by day) and
> then group by DOW _after_ that?
>

​You are correct.​

WITH userdays (dow, user_count) AS ( existing_query, more or less )
​, day_counts (dow, count_of_days) AS ( SELECT
generate_series(user_earliest_created_date, user_most_recent_created_date)
)​
SELECT dow, coalesce(user_count, 0) / count_of_days
FROM day_counts
LEFT JOIN userdays USING (dow)
​;​

David J.
​

Reply via email to