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 are the popular database management systems in the it industry?
Is it important to partition hard disk?
How to pronounce postgresql?
What is the use of primary key?
How to return multiple rows from the stored procedure?
define data blocks ? : Sql dba
What is online transaction processing (oltp)?
Why is partition used in sql?
Can we call procedure in select statement?
What are analytic functions in sql?
what is 'mysqlcheck'? : Sql dba
what is sql in mysql? : Sql dba
How would you convert date into julian date format?
How can we connect an Android App to an Oracle database and use the PL/SQL procedural code?
Why partition by is used in sql?