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
How is a PL/SQL code compiled?
What is the difference between partitioning and sharding?
what is the difference between ereg_replace() and eregi_replace()? : Sql dba
What is sql catalog?
How will you distinguish a global variable with a local variable in pl/sql?
What is the purpose of design view?
How to order siblings in oracle hierarchy queries?
Can a foreign key have a different name?
How many tables can a sql database have?
What is range partitioning?
What are expressions?
How can we make an if statement within a select statement?
Can we use update in sql function?
How delete all records from table in sql?
What is the difference between rename and alias?