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 / vinu
select decode (col1,'a','a','b','b','others') col1,count(col1) from T1 group by decode (col1,'a','a','b','b','others')
| Is This Answer Correct ? | 9 Yes | 2 No |
Post New Answer View All Answers
What is null in pl/sql?
what is cursor and its type, what is ref cursor write a syntax to pass ref cursor into procedure out fucntion and call the procedure
Can we perform dml on view?
What is pl sql code?
What can you do with pl sql?
What is a trigger in sql?
what is a database? : Sql dba
what is the difference between sql and t-sql? : Transact sql
Mention what is the function that is used to transfer a pl/sql table log to a database table?
why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba
What are some predefined exceptions in pl/sql?
What is audit logout in sql profiler?
What are the two types of cursors in pl sql?
What is %type in sql?
What is a temporal data type?