Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Subtracting null from a number

Author  Topic 

Teachme
Starting Member

45 Posts

Posted - 2006-11-07 : 10:08:35
how can i subtract a null from a number..is it possible in sql. i have a number in one column and nulls in another column.
my query should give me all the numbers but i have to do subtraction because in the second column there are som numbers. thanks for ur help.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-07 : 10:10:32
select isnull(somecolumn, 0) - isnull(anothercolumn, 0)
from mytable


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Teachme
Starting Member

45 Posts

Posted - 2006-11-07 : 10:12:14
oh i got it. i just used isnull to make it 0. thanks anyway tat was quick
Go to Top of Page
   

- Advertisement -