On Mon, Sep 9, 2013 at 8:12 AM, Marc Mamin <m.ma...@intershop.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+f7rwzsc1x...@mail.gmail.com http://www.postgresql.org/message-id/1377525567350-5768573.p...@n5.nabble.com