Search Postgresql Archives

Re: dynamic crosstab

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> > Do youthink there is a way to ensure that the order of the values in the
> > array below is the same for each person?
> >
> > tbl(eID, aID, value)
> >
> > Select eID, array_accum(value) from
> > (
> >  (Select Distinct eID from tbl) e
> >   CROSS JOIN
> >  (Select Distinct aID from tbl) a
> > ) ea
> >  LEFT OUTER JOIN
> > tbl USING (eID, aID)
> > GROUP BY eID
> 
> The only way to ever guarantee a particular order is via an ORDER BY
> clause.

Sure. I just didn’t know where to put it - most aggregates don't care about the row order, but for this one it is important.


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux