Search Postgresql Archives

Re: Sum of columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 9, 2013 at 8:12 AM, Marc Mamin <M.Mamin@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxx
http://www.postgresql.org/message-id/1377525567350-5768573.post@xxxxxxxxxxxxx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux