If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Other > Sum of Null Values

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-07-05, 12:19
michaelzakharia michaelzakharia is offline
Registered User
 
Join Date: Mar 2005
Posts: 5
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.
Reply With Quote
  #2 (permalink)  
Old 03-07-05, 21:14
RedAxl RedAxl is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On