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 dense_rank in sql?
What is a trigger in sql?
Is nosql relational?
How do you know if a relationship is 2nf?
What is cross join sql?
Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.
Can a foreign key be null?
How to change sql*plus system settings?
What is oracle sql called?
Is not equal in sql?
What are the types of operators available in sql?
how to include numeric values in sql statements? : Sql dba
What's the procedure?
how to create a table index in mysql? : Sql dba
Define commit?