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 col1;
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What is file based approach?
What is the difference between rename and alias?
what is view? : Sql dba
Enlist some predefined exceptions?
What is trigger in flip flop?
What are tuples in sql?
Can we use commit inside a trigger?
what is blob? : Sql dba
What is nosql vs sql?
What is sqlerrd?
Explain about various levels of constraint.
What are the benefits of stored procedures?
which operator is used in query for pattern matching? : Sql dba
What is data control language?
Can function return multiple values in sql?