Table name: T1, it has only one column.
col1
------
c
b
a
b
b
b
b
d
s
a
a
t
s
Requirement:
I need the following output from the above base table by
using SQL query.
col1 Cnt
----- -------
a 3
b 5
Others 5
Please help.
Thanks
Guru
v.gurus@in.com
Answer Posted / vikneswaran
select decode(col1,'a','a','b','b','Other') "col1",count
(col1) "countval"
from col group by decode(col1,'a','a','b','b','Other');
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How to assign sql query results to pl sql variables?
How do I run a query in pl sql developer?
When should I use nosql database?
How is indexing done in search engines?
Inline the values in PL/SQL, what does it mean.?
what is recursive stored procedure? : Sql dba
What is rowtype?
Which command is used to call a stored procedure?
What is 19 null in sql?
what is heap table? : Sql dba
What is a rank in sql?
What are tables and fields in the database?
Can function return multiple values in sql?
how many sql dml commands are supported by 'mysql'? : Sql dba
What is the difference between instead of trigger and after trigger?