| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Simple SQL Query Question
Okay
but how do you use DECODE with the count(*) ? For example the query
below doesn't work
<SPAN
class=830280711-02072001>
SELECT
decode(reception_freq, null, 1, 2)*count(*) from
my_table
where
station = 'STAT1' ;
<FONT face=Tahoma
size=2>-----Message d'origine-----De : Amar Kumar Padhi
[mailto:TS2017_at_emirates.com]Envoyé : lundi 2 juillet 2001
13:20À : Multiple recipients of list
ORACLE-LObjet : RE: Simple SQL Query
Question
<FONT color=#0000ff face=Courier
size=2>Well, then decode would be the only option, as suggested by other
members. Case is not supported.
<FONT color=#0000ff face=Courier
size=2>
<FONT color=#0000ff face=Courier
size=2>rgds
<FONT color=#0000ff face=Courier
size=2>amar
<FONT face="Times New Roman"
size=2>-----Original Message-----From: ALEMU Abiy
[mailto:abiy.alemu_at_criltechnology.com]Sent: Monday, July 02, 2001
2:00 PMTo: Multiple recipients of list
ORACLE-LSubject: RE: Simple SQL Query
Question
<SPAN
class=370285408-02072001>I'm using Oracle 7.3.4, so is it possible to use
CASE statements ?
<FONT face=Tahoma
size=2>-----Message d'origine-----De : Amar Kumar Padhi
[mailto:TS2017_at_emirates.com]Envoyé : lundi 2 juillet 2001
10:57À : Multiple recipients of list
ORACLE-LObjet : RE: Simple SQL Query
Question
select
count((case when (nvl(emission_freq, 0) != 0 and nvl(reception_freq, 0) !=
0)
then 1 else null end)) * 2 +
count((case when (nvl(emission_freq, 0) != 0 and nvl(reception_freq, 0) !=
0)
then null else 1 end)) * 1 as "total"from
am39
<FONT color=#0000ff face=Courier
size=2>where station = 'xxxx';
<SPAN
class=248073507-02072001>rgds
<SPAN
class=248073507-02072001>amar
<FONT face="Times New Roman"
size=2>-----Original Message-----From: ALEMU Abiy
[mailto:abiy.alemu_at_criltechnology.com]Sent: Monday, July 02,
2001 11:30 AMTo: Multiple recipients of list
ORACLE-LSubject: Simple SQL Query
Question
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>--------
-----------------
------------------
<SPAN
class=270522206-02072001>STAT1
192.5
193.5
<SPAN
class=270522206-02072001>STAT2
193
<SPAN
class=270522206-02072001>STAT2
194
<SPAN
class=270522206-02072001>STAT2
193.5
194.5
<SPAN
class=270522206-02072001>STAT2
195
<SPAN
class=270522206-02072001>
<SPAN
class=270522206-02072001>
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
?
<FONT color=#ff0000 face=Arial
size=2>------------------------------------------------------------------------------------
@biy @lemu
<A
href="mailto:abiy.alemu_at_criltelecom.com">abiy.alemu_at_criltelecom.com
<SPAN
class=630595213-05042001>Database Administration
Engineer
<IMG align=top
alt="Groupe CRIL TECHNOLOGY" height=17 hspace=0
src="http://www.criltechnology.com/images/cril.gif" width=177
NOSEND="1">
France
Received on Mon Jul 02 2001 - 06:14:08 CDT
![]() |
![]() |