Henry House <hajhouse(at)houseag(dot)com> writes:
> the balance forward of the amount column for the user-suplied date correcly
> unless the user supplies a $startdate such that no culumns are being added.
> In this case NULL is returned.
Yeah, for some unfathomable reason SQL92 defines SUM() of no rows to
return NULL, rather than zero as any mathematician would say it should.
Use COALESCE(SUM(...), 0) to replace the null result by 0.
regards, tom lane
In response to
pgsql-novice by date
|Next:||From: Todd T. Fries||Date: 2001-07-13 22:03:49|
|Subject: Re: Serial field|
|Previous:||From: Henry House||Date: 2001-07-13 18:53:38|
|Subject: Cast question (NULL -> NUMERIC)|