[SQL] array_agg() with join question

2013-05-14 Thread George Woodring
To summarize my question at the top, why is it that when I did the JOIN, the array_agg results reversed order? I had a function that ran the following query: SELECT timeslot, pollgrpid, array_agg(outval) FROM (SELECT * FROM rrd.a_current WHERE pollgrpid=8 ORDER BY timeslot, dsnum) AS foo

Re: [SQL] array_agg() with join question

2013-05-14 Thread Igor Neyman
On Tue, May 14, 2013 at 10:08 AM, George Woodring < george.woodr...@iglass.net> wrote: > To summarize my question at the top, why is it that when I did the JOIN, > the array_agg results reversed order? > > I had a function that ran the following query: > > SELECT timeslot, pollgrpid, array_agg(out

Re: [SQL] Correct implementation of 1:n relationship with n>0?

2013-05-14 Thread Wolfgang Keller
> > The point is that I would have expected that problem to be solved > > within the past four decades since relational databases have been > > invented. Or at least in the past two decades since PostgreSQL has > > been developed. > > Then what about n>1, n>2, n>k where k an arbitrarily large posi

Re: [SQL] array_agg() with join question

2013-05-14 Thread George Woodring
Thank you. I was trying to do the order by at the sub-query level. Thanks again. Woody iGLASS Networks www.iglass.net On Tue, May 14, 2013 at 11:37 AM, Igor Neyman wrote: > > > > On Tue, May 14, 2013 at 10:08 AM, George Woodring < > george.woodr...@iglass.net> wrote: > >> To summarize my que