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
Do ddl statements need commit?
Which function is used to return remainder in a division operator in sql?
What is hibernate and its relation to sql?
How much does sql cost?
what are the types of subquery? : Sql dba
How to write a query to show the details of a student from students table whose
What is triggering circuit?
Which is better varchar or nvarchar?
How to run pl sql program in mysql?
What is the difference between nested table and varray?
define sql insert statement ? : Sql dba
What is difference sql and mysql?
What are the set operators in sql?
What are the operators in sql?
Show how functions and procedures are called in a pl/sql block.