Re: Group By aggregate string function - Mailing list pgsql-sql

From David G. Johnston
Subject Re: Group By aggregate string function
Date
Msg-id CAKFQuwa9yvhJLcN2cj7u+eOHE0qfcFy__C32W5F9KtbpafuHeg@mail.gmail.com
Whole thread Raw
In response to Re: Group By aggregate string function  ("Campbell, Lance" <lance@illinois.edu>)
List pgsql-sql
On Thu, Feb 21, 2019 at 12:02 PM Campbell, Lance <lance@illinois.edu> wrote:

Expected Result:

1 lance admin

 

Ignores the second record with lance in it because the first record contained admin.


Ignoring <> Grouping

Grouping:
SELECT x, array_agg(DISTINCT y ORDER BY y)
FROM (VALUES ('a',1),('a',2),('b',1),('c',2)) vals (x,y)
GROUP BY x;

Ignoring:
SELECT DISTINCT ON (x) x, y
FROM (VALUES ('a',1),('a',2),('b',1),('c',2)) vals (x,y)
ORDER BY x, y;
 
David J.
Attachment

pgsql-sql by date:

Previous
From: "Campbell, Lance"
Date:
Subject: Re: Group By aggregate string function
Next
From: Martin Stöcker
Date:
Subject: Re: Group By aggregate string function