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:

[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] must appear in GROUP by clause issue

2012-07-02 Thread George Woodring
gt; wrote: > On Fri, Jun 29, 2012 at 4:02 PM, George Woodring > wrote: > > I have 2 (8.4.11) servers that I am testing the following query: > > > > SELECT count(*), > > maptrunc(cpeloc.lat, 4.5)::text || maptrunc(cpeloc.long, > > 4.5)::

[SQL] must appear in GROUP by clause issue

2012-06-29 Thread George Woodring
c.long)::text --> max(maptrunc(cpeloc.long))::text however, that one breaks on the first server with the error ERROR: aggregates not allowed in GROUP BY clause LINE 1: select count(*), max(maptrunc(cpeloc.lat, 4.5))::text || max... Any suggestions would be appreciated. George Woodring --

Re: [SQL] Inherited table identification possible

2012-05-25 Thread George Woodring
with your version of PG) > > Hope this helps, > --Stephen > > > > On Thu, May 24, 2012 at 2:01 PM, George Woodring < > george.woodr...@iglass.net> wrote: > >> Is it possible to identify which inherited table data came from in a >> query? We have a table tha

[SQL] Inherited table identification possible

2012-05-24 Thread George Woodring
Is it possible to identify which inherited table data came from in a query? We have a table that has 3 inherited tables attached to it. I am looking for a way to identify the source of the data. My only thought would be to add a column to the tables that identify the table. I was just checking

[SQL] Advice returning data as an array

2009-08-20 Thread George Woodring
I have the following query that works the way I need: SELECT '20090812' AS date, sum(in_oct) AS bytes, sum(in_pkt) AS pkts, 'appl' AS name, ARRAY['appl'] AS fields, CAST((LEAST(src_port, dst_port)) AS varchar) as fieldVal FROM flow_history.flows_20090812 GROUP BY fieldVal ORDER BY bytes DESC LIMIT