Re: Sum of columns

From: BladeOfLight16 <bladeoflight16(at)gmail(dot)com>
To: "janek12(at)web(dot)de" <janek12(at)web(dot)de>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sum of columns
Date: 2013-09-12 23:58:11
Message-ID: CA+=1U=U7vQ1rXr4mqEttjXQRVw0iyC8b19epfKTmGQBJTATccQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Sep 9, 2013 at 8:12 AM, Marc Mamin <M(dot)Mamin(at)intershop(dot)de> wrote:

> hi,
>
> in addition to the others comments, you can also remove " ELSE 0 " from
> your query.****
>
> It will result in <NULL> values that are discarded by SUM.****
>
>
For that matter, you could clean this up by using COUNT as your aggregate
with a GROUP BY. See these two archives:
http://www.postgresql.org/message-id/CA+=1U=U-=OQv6P24PP7HrO3dvAf3mH-oELTT7+F7RWZsC1XkMQ@mail.gmail.com
http://www.postgresql.org/message-id/1377525567350-5768573.post@n5.nabble.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Travers 2013-09-13 00:25:26 Re: Best way to populate nested composite type from JSON`
Previous Message David Johnston 2013-09-12 22:57:34 Re: problem with query