Re: GROUP BY overlapping (tsrange) entries

Поиск
Список
Период
Сортировка
От Andreas Joseph Krogh
Тема Re: GROUP BY overlapping (tsrange) entries
Дата
Msg-id VisenaEmail.b.916ec1039648dd16.1528aeb4a70@tc7-visena
обсуждение исходный текст
Ответ на Re: GROUP BY overlapping (tsrange) entries  (Michael Moore <michaeljmoore@gmail.com>)
Ответы Re: GROUP BY overlapping (tsrange) entries
Re: GROUP BY overlapping (tsrange) entries
Список pgsql-sql
På fredag 29. januar 2016 kl. 02:02:46, skrev Michael Moore <michaeljmoore@gmail.com>:
It is unclear to me how you got from your input data to your expected output. If you are "trying to count() overlapping entries" then it would seem to me that you would only have only one value for the count. Either a range overlaps or it does not.
 
Oh, sorry, the count was in wrong order.
 
Let me explain,
insert into event(name, start_time, end_time)    values('a', '2015-12-20', NULL)        , ('a', '2015-12-20', '2015-12-31')        , ('a', '2015-12-25', '2016-01-01')        , ('b', '2015-11-20', '2015-11-24')        , ('c', '2016-02-01', '2016-02-03')        , ('c', '2016-02-01', '2016-02-04')
        , ('c', '2016-02-01', NULL)
;
All 'a', 'b' and 'c' have points in common, with count a=3, b=1, c=3.
 
Thanks.
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Вложения

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

Предыдущее
От: Michael Moore
Дата:
Сообщение: Re: GROUP BY overlapping (tsrange) entries
Следующее
От: Andreas Joseph Krogh
Дата:
Сообщение: Re: GROUP BY overlapping (tsrange) entries