depending on your sql dialect you could try: SELECT IF(s1 IS NULL, 0, s1) + IF(... SELECT IFNULL(s1, 0, s1) + IFNULL(... SELECT COALESCE(s1, 0) + COALESCE(...
Steve > -----Original Message----- > From: John - Pacific Data Systems (NZ) [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 21 April 2004 8:36 p.m. > To: DUG > Subject: [DUG] simple db query > > > Hi all, > > I'd like to add multiple fields in a db query. That is not a > problem, like: > > select s1+s2+s3 as TotalAmount > > However, when one of the field values is null, then the > result is zero. How > can I get this to work? > > TIA, > > John > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.655 / Virus Database: 420 - Release Date: 8/04/2004 > > _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
