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 / vinu
select decode (col1,'a','a','b','b','others') col1,count(col1) from T1 group by decode (col1,'a','a','b','b','others')
| Is This Answer Correct ? | 9 Yes | 2 No |
Post New Answer View All Answers
how to extract a unit value from a date and time? : Sql dba
What is a constraint?
Does sap use sql?
How to fix oracle error ora-00942: table or view does not exist
what are the authentication modes in sql server? How can it be changed? : Sql dba
What is sql indexing?
What are the types of subqueries?
What is the maximum size of sqlite database?
What is the difference between count 1 and count (*) in a sql query?
Do foreign keys improve performance?
What is pl sql commands?
What will you get by the cursor attribute sql%rowcount?
what is the difference between char_length and length? : Sql dba
Explain the uses of a database trigger?
What are predefined functions in sql?