| From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
|---|---|
| To: | "Campbell, Lance" <lance(at)illinois(dot)edu> |
| Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Group By aggregate string function |
| Date: | 2019-02-21 19:53:59 |
| Message-ID: | CAKFQuwa9yvhJLcN2cj7u+eOHE0qfcFy__C32W5F9KtbpafuHeg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On Thu, Feb 21, 2019 at 12:02 PM Campbell, Lance <lance(at)illinois(dot)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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Martin Stöcker | 2019-02-21 20:06:15 | Re: Group By aggregate string function |
| Previous Message | Campbell, Lance | 2019-02-21 19:02:27 | Re: Group By aggregate string function |