Re: SQL help - multiple aggregates

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: hamann(dot)w(at)t-online(dot)de
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: SQL help - multiple aggregates
Date: 2016-08-18 13:00:24
Message-ID: CAKFQuwZ-+MzeaPb-EUfAa7OJY+noxyoESSP+XUgwf666ChPM7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Aug 18, 2016 at 4:56 AM, <hamann(dot)w(at)t-online(dot)de> wrote:​

> select custid, count(vendid) as c415 from cv where vendid = 415 group by
> custid
> ​[...]
>
> Is there a better way (by creating an aggregate function, perhaps)
>

​You may find crosstab in the tablefuncs extension to be of use.


https://www.postgresql.org/docs/current/static/tablefunc.html

​David J.​

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2016-08-18 13:51:10 Re: SQL help - multiple aggregates
Previous Message Ladislav Lenart 2016-08-18 12:51:29 Re: SQL help - multiple aggregates