Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-26 Thread Rafał Pietrak
W dniu 04/26/2013 09:54 PM, Misa Simic pisze: SELECT DISTINCT a, b, c, array_agg(d) OVER (PARTITION BY c ) FROM ( SELECT a, b, c, d FROM testy where e <> 'email' and c='1035049' ORDER BY a, b, c, e ) t Doesnt give u desired result? Hmm... actualy, it looks like it does. I wouldn't th

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-26 Thread Misa Simic
SELECT DISTINCT a, b, c, array_agg(d) OVER (PARTITION BY c ) FROM ( SELECT a, b, c, d FROM testy where e <> 'email' and c='1035049' ORDER BY a, b, c, e ) t Doesnt give u desired result? On Friday, April 26, 2013, Rafał Pietrak wrote: > W dniu 04/26/2013 05:25 PM, Tom Lane pisze: > >> =

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-26 Thread Rafał Pietrak
W dniu 04/26/2013 05:25 PM, Tom Lane pisze: =?ISO-8859-2?Q?Rafa=B3_Pietrak?= writes: array_agg(distinct v order by v) -- works in postgres, but actually I need: array_agg(distinct v order by v,x) -- which doesn't. (ERROR: expressions must appear in argument list), Why do you think you need

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-26 Thread Tom Lane
=?ISO-8859-2?Q?Rafa=B3_Pietrak?= writes: > array_agg(distinct v order by v) -- works in postgres, but actually I need: > array_agg(distinct v order by v,x) -- which doesn't. (ERROR: > expressions must appear in argument list), Why do you think you need that? AFAICS, the extra order-by colum

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-26 Thread Rafał Pietrak
W dniu 04/26/2013 12:25 AM, Merlin Moncure pisze: [--] select array_agg(v order by v desc) from generate_series(1,3) v; also, 'distinct' select array_agg(distinct v order by v desc) from (select generate_series(1,3) v union all select generate_series(1,3)) q; [

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-26 Thread Merlin Moncure
On Fri, Apr 26, 2013 at 3:15 AM, Rafał Pietrak wrote: > W dniu 04/26/2013 12:25 AM, Merlin Moncure pisze: > >> On Thu, Apr 25, 2013 at 1:30 PM, Rafał Pietrak >> wrote: > > [--] > >>> >>> No, I don't (manual: >>> http://www.postgresql.org/docs/9.1/static/tutorial-window.html, h

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-26 Thread Rafał Pietrak
W dniu 04/26/2013 12:25 AM, Merlin Moncure pisze: On Thu, Apr 25, 2013 at 1:30 PM, Rafał Pietrak wrote: [--] No, I don't (manual: http://www.postgresql.org/docs/9.1/static/tutorial-window.html, have just one word "distinct" on that page, and it's not in the above context).

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-25 Thread Merlin Moncure
On Thu, Apr 25, 2013 at 1:30 PM, Rafał Pietrak wrote: > W dniu 04/25/2013 03:44 PM, Merlin Moncure pisze: > > On Wed, Apr 24, 2013 at 2:44 AM, Rafał Pietrak > wrote: > > W dniu 03/24/2013 12:11 PM, Rafał Pietrak pisze: > > W dniu 03/24/2013 12:06 PM, Misa Simic pisze: > > maybe, > > SELECT DISTIN

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-25 Thread Rafał Pietrak
W dniu 04/25/2013 03:44 PM, Merlin Moncure pisze: On Wed, Apr 24, 2013 at 2:44 AM, Rafał Pietrak wrote: W dniu 03/24/2013 12:11 PM, Rafał Pietrak pisze: W dniu 03/24/2013 12:06 PM, Misa Simic pisze: maybe, SELECT DISTINCT issuer,amount, array_agg(REFERENCE) over (partition by invoice_nr) fro

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-25 Thread Merlin Moncure
On Wed, Apr 24, 2013 at 2:44 AM, Rafał Pietrak wrote: > W dniu 03/24/2013 12:11 PM, Rafał Pietrak pisze: > > W dniu 03/24/2013 12:06 PM, Misa Simic pisze: > > maybe, > > SELECT DISTINCT issuer,amount, array_agg(REFERENCE) over (partition by > invoice_nr) from invoices; > > > RIGHT. Thenx. (and the

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-25 Thread Misa Simic
SELECT DISTINCT a, b, c, array_agg(k.d) OVER (PARTITION BY k.c ) FROM testy k where k.e <> 'email' and k.c='1035049' ORDER BY a, b, c, e If doesnt work - Probably there is a better option... In worst case I would do SELECT DISTINCT a, b, c, array_agg(d) OVER (PARTITION BY c ) FROM ( SELECT

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-04-24 Thread Rafał Pietrak
W dniu 03/24/2013 12:11 PM, Rafał Pietrak pisze: W dniu 03/24/2013 12:06 PM, Misa Simic pisze: maybe, SELECT DISTINCT issuer,amount, array_agg(REFERENCE) over (partition by invoice_nr) from invoices; RIGHT. Thenx. (and the first thing I did, I've read the doc on array_agg() what stress

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-03-24 Thread Rafał Pietrak
W dniu 03/24/2013 12:06 PM, Misa Simic pisze: maybe, SELECT DISTINCT issuer,amount, array_agg(REFERENCE) over (partition by invoice_nr) from invoices; RIGHT. Thenx. (and the first thing I did, I've read the doc on array_agg() what stress makes from people :( thenx again, -R 2013

Re: [GENERAL] is there a way to deliver an array over column from a query window?

2013-03-24 Thread Misa Simic
maybe, SELECT DISTINCT issuer,amount, array_agg(REFERENCE) over (partition by invoice_nr) from invoices; 2013/3/24 Rafał Pietrak > Hi, > > I really don't know how to ask for what I'm looking for; but I think, may > be, calling it an ARRAY yielding aggregate function for use within a query > WI

[GENERAL] is there a way to deliver an array over column from a query window?

2013-03-24 Thread Rafał Pietrak
Hi, I really don't know how to ask for what I'm looking for; but I think, may be, calling it an ARRAY yielding aggregate function for use within a query WINDOW would do? I'm looking for something like: SELECT DISTINCT issuer,amount, array(REFERENCE) over (partition by invoice_nr) from invoi