| От | Tom Lane |
|---|---|
| Тема | Re: getting daily stats for event counts |
| Дата | |
| Msg-id | 2153718.1592929710@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | getting daily stats for event counts (David Gauthier <davegauthierpg@gmail.com>) |
| Список | pgsql-general |
David Gauthier <davegauthierpg@gmail.com> writes:
> I have a table which logs the inception of an event with an
> "incept_datetime" (timestamptz) field. I want to know how many events
> occurred per day from one date to the next using midnight as a marker for
> each day reported. The end result should be something like...
> 2019-06-23 44
> 2019-06-24 18
> 2019-06-25 38
> etc...
> Is there a query that can do this ?
Something involving GROUP BY date_trunc('day', incept_datetime)
ought to do it, possibly with some fooling around required
depending on what definition of "midnight" you want to use.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера