Re: [GENERAL] SQL help - multiple aggregates

2016-08-18 Thread Francisco Olarte
CCing to the list ( if you are new to this list, messages come from the sender address, you have to use "reply all" ( at least in my MUA, web gmail ) to make your replies appear in the list ). On Thu, Aug 18, 2016 at 3:03 PM, wrote: > Hi Francisco, > thanks a lot. I will give it a try later Do

Re: [GENERAL] SQL help - multiple aggregates

2016-08-18 Thread David G. Johnston
On Thu, Aug 18, 2016 at 4:56 AM, 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.postgres

Re: [GENERAL] SQL help - multiple aggregates

2016-08-18 Thread Ladislav Lenart
Hello. On 18.8.2016 10:56, haman...@t-online.de wrote: > > Hi, > > I have a table cv with custid and vendid columns. Every entry represents the > purchase of a product > available from a specific vendor. > Now, for a set of "interesting" vendors, I would like to select a new table > custid, c

Re: [GENERAL] SQL help - multiple aggregates

2016-08-18 Thread Francisco Olarte
On Thu, Aug 18, 2016 at 10:56 AM, wrote: > I have a table cv with custid and vendid columns. Every entry represents the > purchase of a product > available from a specific vendor. > Now, for a set of "interesting" vendors, I would like to select a new table > custid, c415, c983, c1256 > based up

[GENERAL] SQL help - multiple aggregates

2016-08-18 Thread hamann . w
Hi, I have a table cv with custid and vendid columns. Every entry represents the purchase of a product available from a specific vendor. Now, for a set of "interesting" vendors, I would like to select a new table custid, c415, c983, c1256 based upon part queries select custid, count(vendid) as