Re: [GENERAL] Finding date intersections

2014-10-25 Thread Joe Van Dyk
On Sat, Oct 25, 2014 at 5:00 AM, wrote: > John McKown writes: > > > ​I've been think about this for a bit. But I'm not getting a real > solution. > > I have an approach, shown below, that I think might be the bare > beginnings > > of an approach, but I'm just not getting any more inspiration. Pe

Re: [GENERAL] Finding date intersections

2014-10-25 Thread hari . fuchs
John McKown writes: > ​I've been think about this for a bit. But I'm not getting a real solution. > I have an approach, shown below, that I think might be the bare beginnings > of an approach, but I'm just not getting any more inspiration. Perhaps it > will spark an idea for you or someone else.

Re: [GENERAL] Finding date intersections

2014-10-24 Thread Joe Van Dyk
On Fri, Oct 24, 2014 at 11:02 AM, David G Johnston < david.g.johns...@gmail.com> wrote: > John McKown wrote > >> insert into sales values > >> (tstzrange('2014-1-1', '2014-1-2')), > >> (tstzrange('2014-1-2', '2014-1-3')), > >> (tstzrange('2014-1-2', '2014-1-4')), > >> (tstzrange('2014-1-5'

Re: [GENERAL] Finding date intersections

2014-10-24 Thread David G Johnston
John McKown wrote >> insert into sales values >> (tstzrange('2014-1-1', '2014-1-2')), >> (tstzrange('2014-1-2', '2014-1-3')), >> (tstzrange('2014-1-2', '2014-1-4')), >> (tstzrange('2014-1-5', '2014-1-6')); >> >> -- want back: >> -- tstzrange('2014-1-1', '2014-1-4') >> -- tstzrange('2014

Re: [GENERAL] Finding date intersections

2014-10-24 Thread John McKown
On Thu, Oct 23, 2014 at 9:10 PM, Joe Van Dyk wrote: > I have a table of sales that have possibly overlapping time ranges. I want > to find all the timeranges where there's an active sale. How would you do > that? > > create table sales ( > times tstzrange > ); > > insert into sales values > (

[GENERAL] Finding date intersections

2014-10-23 Thread Joe Van Dyk
I have a table of sales that have possibly overlapping time ranges. I want to find all the timeranges where there's an active sale. How would you do that? create table sales ( times tstzrange ); insert into sales values (tstzrange('2014-1-1', '2014-1-2')), (tstzrange('2014-1-2', '2014-1-3')