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
How to prepare for oracle pl sql certification?
What are the topics in pl sql?
What is sqlca in db2?
what are the 'mysql' command line options? : Sql dba
How do you optimize a query?
is mysql query is case sensitive? : Sql dba
What is sql*loader?
What is difference between mysql and postgresql?
What is a recursive stored procedure?
what are the advantages and disadvantages of cascading style sheets? : Sql dba
What is package in pl sql with an examples?
what is oracle database ? : Sql dba
Why do we use %rowtype & %type in plsql?
Is it possible to include an insert statement on the same table to which the trigger is assigned?
Is and as keyword in pl sql?