Re: Average New Users Per DOW

Поиск
Список
Период
Сортировка
От Robert DiFalco
Тема Re: Average New Users Per DOW
Дата
Msg-id CAAXGW-wc2sDxrxYLjPd_Bsf=AbTYOTNO4g-44ufp6L1s-YN33g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Average New Users Per DOW  (Paul Jungwirth <pj@illuminatedcomputing.com>)
Ответы Re: Average New Users Per DOW  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Average New Users Per DOW  (Paul Jungwirth <pj@illuminatedcomputing.com>)
Список pgsql-general
Thanks Paul, I guess I'm not sure how a generate_series between 0 to 6 would solve this problem. Wouldn't I have to generate a series based on the date range (by day) and then group by DOW _after_ that? Can you give me an example of how I'd do it with a series based on 0 to 6?

On Mon, Jul 6, 2015 at 10:58 AM, Paul Jungwirth <pj@illuminatedcomputing.com> wrote:
> I'm not sure how to create a result where I get the average number of
> new users per day of the week. My issues are that days that did not
> have any new users will not be factored into the average

This is a pretty common problem with time-series queries when there is sparse data. My go-to solution is to use generate_series---in your case from 0 to 6---then do a left join from there to your actual data.

Paul





--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: Paul Jungwirth
Дата:
Сообщение: Re: Average New Users Per DOW
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Average New Users Per DOW