Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Simple SQL Query Question
For
example for a table like this one,
<SPAN
class=250325508-02072001>
<FONT
face=Arial size=2>STATION EMISSION_FREQ
RECEPTION_FREQ ---------- ------------- -------------- STAT1 192.5 193.5 STAT2 192.5 STAT2 194 STAT1 193.5 194.5 STAT2 195
<SPAN
class=250325508-02072001>
<SPAN
class=250325508-02072001>
I
would like to have a value for STAT1 which is equal to 2*2=4 and for STAT2
equal to 3*1=3
<FONT face=Tahoma
size=2>-----Message d'origine-----De : novicedba
[mailto:novicedba_at_hotmail.com]Envoyé : lundi 2 juillet 2001
11:15À : Multiple recipients of list
ORACLE-LObjet : Re: Simple SQL Query
Question
SELECT
STATION,EMISSION_FREQ,RECEPTION_FREQ,DECODE(SUBSTR(NVL(TO_CHAR(RECEPTION_FREQ),'NONE'),1,1),'N',EMISSION_FREQ*1,EMISSION_FREQ*2)
VALUEFROM TEST;
STATION
EMISSION_FREQ RECEPTION_FREQ
VALUE---------- ------------- -------------- ---------STAT1 192.5 193.5 385STAT2 192.5 192.5STAT2 194 194STAT2 193.5 194.5 387STAT2 195195
<SPAN
class=270522206-02072001> the reception_freq is null (that
would mean there is only emission_freq )
then
<SPAN
class=270522206-02072001> <FONT
face=Arial>value=emission_freq*1
<SPAN
class=270522206-02072001>else
value=emission_freq*1
end
if
<SPAN
class=270522206-02072001>
Hope this is what
you wanted
<SPAN
class=270522206-02072001>
cozI am anoviceOracle Certifiable DBBS
<BLOCKQUOTE dir=ltr
style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
I've a table
with the following structure and sample data :
<SPAN
class=270522206-02072001>
<SPAN
class=270522206-02072001>Station
Emission_Freq
Reception_Freq
<SPAN
class=270522206-02072001>-------- ----------------- ------------------
192.5
193.5
size=2>------------------------------------------------------------------------------------@biy @lemu
![]() |
![]() |