Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Posts
    5

    Unanswered: Sum of Null Values

    Hello,

    I am adding values from different records which may contain Null values, it then returns nothing.

    I noticed in Interbase version 6.1, if a record has a null value and you try adding it up like 'Select sum(SellingQty) etc..' the returned value is null. How can I resolve this problem. I am using Delphi v7 accessing Interbase 6.1.

    Many thanks in advance.

  2. #2
    Join Date
    Nov 2004
    Posts
    39
    Hi,

    Im not familiar with Interbase, but im sure it has a function that checks if the data is Null. (IFNULL, ISNULL, etc.)

    The trick is you must replace all the Null values with 0.

    In Ingres Database query, It looks like this:

    SELECT SUM(IFNULL(SellingQty,0))
    FROM tablename


    Red

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •