From abiy.alemu@criltechnology.com Mon, 02 Jul 2001 02:14:15 -0700 From: ALEMU Abiy Date: Mon, 02 Jul 2001 02:14:15 -0700 Subject: RE: Simple SQL Query Question Message-ID: MIME-Version: 1.0 Content-Type: text/plain For example for a table like this one,   STATION    EMISSION_FREQ   RECEPTION_FREQ    ----------         -------------                --------------                   STAT1              192.5                  193.5                         STAT2              192.5                                                   STAT2              194                                                       STAT1              193.5                  194.5                          STAT2              195                                                           I would like to have a value for STAT1 which is equal to 2*2=4  and for STAT2 equal to 3*1=3 -----Message d'origine-----De : novicedba [mailto:novicedba@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              195                                                       195   I did not understand what you meant by 'And I would like to select the number of frequencies, sort of count(*), for a given station and multiply that value by 2 ' so what I have done is if     the reception_freq is null (that would mean there is only emission_freq ) then     value=emission_freq*1 else     value=emission_freq*1 end if   Hope this is what you wanted   cozI am anoviceOracle Certifiable DBBS
----- Original Message -----
From: ALEMU Abiy To: Multiple recipients of list ORACLE-L Sent: Monday, July 02, 2001 1:00 PM Subject: Simple SQL Query Question I've a table with the following structure and sample data :   Station        Emission_Freq        Reception_Freq --------        -----------------        ------------------ STAT1        192.5                        193.5 STAT2        193    STAT2        194 STAT2        193.5                        194.5 STAT2        195     And I would like to select the number of frequencies, sort of count(*), for a given station and multiply that value by 2 if the station has Emission frequency and reception frequency and multiply by one if the station has only the emission frequency or only the reception frequency.  I don't know how to use a condition in SQL.  I'm sure that it's possible to do it but I don't know how.  Can anybody help me ? ------------------------------------------------------------------------------------ @biy @lemu abiy.alemu@criltelecom.com Database Administration Engineer Groupe CRIL TECHNOLOGY France