query [message #255578] |
Wed, 01 August 2007 04:22 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
meeta
Messages: 28 Registered: January 2000
|
Junior Member |
|
|
Hi all,
i have a table with thse structure abc(vi number,v2 number,v3 number)
Data is like this
Quote: | abc
vi v2 v3
0 0 10
30 0 0
0 20 0
|
i want to have following output
Kindly help me how to do so, i need to select any non zero value from thses 3 columns
|
|
|
|
Re: query [message #255593 is a reply to message #255582] |
Wed, 01 August 2007 04:37 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
meeta
Messages: 28 Registered: January 2000
|
Junior Member |
|
|
Hi thanks,
i tried using decode but it didnt work out
can u tell me hw to do it using decode
|
|
|
Re: query [message #255810 is a reply to message #255593] |
Wed, 01 August 2007 16:14 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
GREATEST might be a function you are looking for:SQL> select * From abc;
VI V2 V3
---------- ---------- ----------
0 0 10
30 0 0
0 20 0
SQL> select greatest(vi, v2, v3) from abc;
GREATEST(VI,V2,V3)
------------------
10
30
20
|
|
|