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 fix oracle error ora-00942: table or view does not exist
How can get second highest salary in sql?
What is not null in sql?
What are the ways on commenting in a pl/sql code?
how to enter numeric values as hex numbers? : Sql dba
What does the base_object_type column shows in the user.triggers data dictionary view?
What is the syntax to add a record to a table?
how is exception handling handled in mysql? : Sql dba
Is there a way to automate sql execution from the command-line, batch job or shell script?
how to start mysql server? : Sql dba
What is sql and explain its components?
Explain the working of primary key?
Is it possible to Restore a Dropped Table using Rollback Command in Oracle SQL Plus ?
Is oracle and sql same?
What are the parameter modes supported by pl/sql?