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
Explain locks? : Transact sql
Explain exception handling in pl/sql?
What is a join query?
How many types of triggers exist in pl/sql?
What are the types of keys?
Who developed sql?
What is the difference between microsoft access and sql server?
how can you see all indexes defined for a table? : Sql dba
How are sql commands classified?
who introduced sql?
what is the use of set statement in tsql? : Transact sql
What is difference between stored procedures and application procedures?
How do you determine the current isolation level? : Transact sql
How do I start pl sql?
what happens if null values are involved in expressions? : Sql dba