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
What is using in sql?
how can we destroy the session, how can we unset the variable of a session? : Sql dba
How can you create an empty table from an existing table?
What are different types of tables in sql?
What is the use of partition by in sql?
What normalization means?
How to move files from one directory to another in pl sql?
What is nvarchar in sql?
what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba
What is sql integrity?
What are aggregate and scalar functions?
What is the difference between cross join and natural join?
What is the difference between distinct and unique in sql?
What is difference between table and view?
What are the limitations of sql express?