Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > IBM DB2 > How to calculat...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 8897 of 9520
Post > Topic >>

How to calculate difference between 2 columns excluding nulls

by "lenygold via DBMonster.com" <u41482@[EMAIL PROTECTED] > May 19, 2008 at 10:20 PM

Here is my input table:

   TUE         MON        
----------- -----------
          2           -
          -          25
         27           -
          -          48
         50           -
          -          78
          3           -
          -          40
         42           -
          -          62
         65           -
          -          85
          4           -
          -          40
         42           -
          -          62
         68           -
          -          92
What is the best way to calculate difference between not NULL MON and
previous not NULL TUE 

25 - 2
48 - 27
........
62 - 40
92 - 68

I did it by creating separated tables for MON and TUE AND THEN JOIN BASED
ON
ROW NUMBER
Any more creative solutions.
Thank's in advance
Leny G.

-- 
Message posted via http://www.dbmonster.com
 




 8 Posts in Topic:
How to calculate difference between 2 columns excluding nulls
"lenygold via DBMons  2008-05-19 22:20:06 
Re: How to calculate difference between 2 columns excluding null
"lenygold via DBMons  2008-05-19 22:26:47 
Re: How to calculate difference between 2 columns excluding null
"The Boss" <  2008-05-20 00:47:40 
Re: How to calculate difference between 2 columns excluding null
"lenygold via DBMons  2008-05-19 23:01:18 
Re: How to calculate difference between 2 columns excluding null
Serge Rielau <srielau@  2008-05-19 20:00:35 
Re: How to calculate difference between 2 columns excluding null
Tonkuma <tonkuma@[EMAI  2008-05-19 17:11:40 
Re: How to calculate difference between 2 columns excluding null
Tonkuma <tonkuma@[EMAI  2008-05-19 17:48:06 
Re: How to calculate difference between 2 columns excluding null
"lenygold via DBMons  2008-05-20 15:22:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 20:42:29 CST 2008.