GROUP BY hour

Поиск
Список
Период
Сортировка
От Nathan Thatcher
Тема GROUP BY hour
Дата
Msg-id d9c17fb40808011055w750d6634ga5d6fca6b868fa25@mail.gmail.com
обсуждение исходный текст
Ответы Re: GROUP BY hour  (Steve Crawford <scrawford@pinpointresearch.com>)
Re: GROUP BY hour  (Osvaldo Rosario Kussama <osvaldo.kussama@gmail.com>)
Список pgsql-general
I have, what I imagine to be, a fairly simple question. I have a query
that produces output for a line graph. Each row represents an interval
on the graph.

SELECT COUNT(call_id) AS value, EXTRACT(hour from start_time) AS hour
FROM c_call WHERE  start_time >= '2008-08-01 00:00:00' AND end_time <=
'2008-08-01 23:59:59' GROUP BY hour


This works great when there is data in each interval but when a given
interval has no data the group is omitted. What is the best way to
ensure that the result contains a row for each interval with the value
field set to zero or null? The reporting tool is incapable of filling
in the gaps.

Thanks

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

Предыдущее
От: "EXT-Rothermel, Peter M"
Дата:
Сообщение: Savepoints and SELECT FOR UPDATE in 8.2
Следующее
От: Steve Crawford
Дата:
Сообщение: Re: GROUP BY hour