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
Can you join views in sql?
What do we need to check in database testing?
How do I run pl sql in sql developer?
What is the difference between count 1 and count (*) in a sql query?
What is the process of copying data from table a to table b?
Mention what is the use of function "module procedure" in pl/sql?
What is view? Can we update view
what are the advantages a stored procedure? : Sql dba
Can you call pl/sql package functions from within a fast formula?
how can we transpose a table using sql (changing rows to column or vice-versa) ? : Sql dba
What are pl/sql cursor exceptions?
What are the triggers associated with image items?
what are the drivers in mysql? : Sql dba
Is pl sql different from sql?
What is trigger price?