Re: [SQL] how many times

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [SQL] how many times
Дата
Msg-id CAKFQuwayoTvjZLsNCAenHBgHp1172HUC5CHzrAfzhRFckY8TFg@mail.gmail.com
обсуждение исходный текст
Ответ на [SQL] how many times  ("Campbell, Lance" <lance@illinois.edu>)
Ответы Re: [SQL] how many times
Список pgsql-sql
On Wed, Aug 23, 2017 at 11:03 AM, Campbell, Lance <lance@illinois.edu> wrote:

On average in any consecutive five minute time frame how many times is the web page viewed?


​Do you want:

(00,05], (05,10], etc
or
(00,05], (01,06]​, (02, 07], etc

In either case you would want to build out a table containing that start and end points (two columns or an actual range-typed column), then join T1 to that table with an ON clause (t1.timestamp BETWEEN r1.rangestart AND r1.rangeend)

Then:
SELECT r1.rangein, count(t1.id)
FROM t1 RIGHT JOIN r1 ON (...)
GROUP BY r1.rangeid

You have to build the range table if you want to be able to show zero counts.

David J.

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

Предыдущее
От: "Campbell, Lance"
Дата:
Сообщение: Re: [SQL] how many times
Следующее
От: Michael Moore
Дата:
Сообщение: Re: [SQL] how many times