Home » SQL & PL/SQL » SQL & PL/SQL » VERY URGENT PLEASE HELP
VERY URGENT PLEASE HELP [message #37772] Wed, 27 February 2002 09:42 Go to next message
Nina
Messages: 113
Registered: March 2000
Senior Member
Does anyone know how one can perform a count on the returned by decode statement values?
I have the following example of decode:

DECODE(my_value, 'F', 'First Value', 'S', 'Second Value', 'T', 'Third Value').

In the end of the select I need to have the count of ALL these values. So it would look something like:

First Value - 9
Second Value - 8
Third Value - 0

Any ideas whould be great!
Thank you in advance.

First Value -
Re: VERY URGENT PLEASE HELP [message #37774 is a reply to message #37772] Wed, 27 February 2002 12:15 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Do you mean something like:

select decode(my_value, 'F', 'First Value', 'S', 'Second Value', 'T', 'Third Value') value, count(*) count
  from t
 group by my_value;
 
VALUE            COUNT
------------ ---------
First Value          8
Second Value         2
Third Value          5
Re: VERY URGENT PLEASE HELP [message #37790 is a reply to message #37772] Thu, 28 February 2002 05:57 Go to previous message
Nina
Messages: 113
Registered: March 2000
Senior Member
Yes, thank you so much!
Previous Topic: Re: JOIN SQL QUERY
Next Topic: Re: Oracle sysdate to return milliseconds
Goto Forum:
  


Current Time: Thu Apr 18 08:20:11 CDT 2024