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 / rakesh prasad
select name ,count(name)as cnt from (
select case when ((name ='a') or (name = 'b') )then name
else
'others' end as 'name' from tbl_count ) as temp group by
name
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is trigger price?
What are the 3 modes of parameter?
Explain how exception handling is done in advance pl/sql?
what is 'trigger' in sql? : Sql dba
Is sqlite thread safe?
Is sql a microsoft product?
Does truncate need commit?
What is pl sql record in oracle?
Why do we use subquery?
What does count (*) mean in sql?
What is localdb mssqllocaldb?
how to include character strings in sql statements? : Sql dba
Why use triggers in sql?
What is sql keyword?
Which is better join or subquery?