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
Is left join inner or outer?
What is bulk collect in pl sql?
What are the differences between implicit and explicit cursors?
What are the different types of tables in sql?
What is pivot table in sql?
Enlist the data types that can be used in pl/sql?
Is it important to partition hard disk?
How do you optimize a query?
What is the basic form of sql query?
Can we use threading in pl/sql?
What is error ora-12154: tns:could not resolve the connect identifier specified?
When a dml statement is executed, in which cursor attributes, the outcome of the statement is saved?
What are the benefits of triggers?
Is sql easier than java?
Can we update views in sql?