Home » SQL & PL/SQL » SQL & PL/SQL » About computation on two columns values
About computation on two columns values [message #20464] Mon, 27 May 2002 00:03 Go to next message
Naveed Bhagwani
Messages: 4
Registered: May 2002
Junior Member
hi sir i want number columns from two diff tables

i want that if col1 value exist then col2 should remain null and the value of col two goes to 2nd row
(vice versa)
it is like this ....
c1 c2
---- ----
9 6
1 0
7 null
null 3
2 5
5 row(s)

it should look like this....

c1 c2
---- ----
9 null
null 6
1 null
null 0
7 null
null 3
2 null
null 5

8 row(s)

Thanks for prompt reply
Thanks in Advance
Re: About computation on two columns values [message #20465 is a reply to message #20464] Mon, 27 May 2002 02:18 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Try the following:
SELECT col1
, DECODE(col1, NULL, col2, NULL) col2
FROM your_table
UNION
SELECT DECODE(col2, NULL, col1, NULL) col1
, col2
FROM your_table
/

HTH,
MHE
Previous Topic: Error
Next Topic: Constraint Problem
Goto Forum:
  


Current Time: Thu Apr 25 21:48:14 CDT 2024