Re: Aggregate SUM
Posted in 1999
David: If you mean a 4GL report the correct syntax is: select sum(col1) where col1 = ...... the same for group sum. This is described in the 4GL manuals Good luck David Tucker wrote: > My question was a little more general than you thought. > > I don't need to identify nulls. I would just like know if > you can have conditions within the aggregate function SUM. > > (i.e. SUM(col1 WHERE col2 = "01") > > Thanks for your time.... though > > Brett Randall (REMOVECAPITALSbrett_s_r@hotmail.com) wrote: > : David, > > : I seem to recall tackling this problem in the distant past. > > : I assume that you are coding a standard Informix 4GL report script. If > : so, one way of achieving what you are after is to replace NULLS with > : ZEROS in the column(s) (record fields) you want to sum after the records > : are fetched from the database, but before they are passed to the > : report. That is, fetch the record, check for NULLS, and if found > : replace them with ZEROS. This will allow the sum to function properly. > > : This assumes of course that you don't need to distinguish between > : records that contain NULLS or ZEROS in those column(s). > > : HTH, > > : Brett > > : David Tucker wrote: > > : > when using the aggregste function (sum) in a report.... > : > > : > is there a way to place a conditional statemment within > : > (i.e.) > : > sum(col1 where col1 is not null)