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 / kumarvijay
select decode(dept_id,1,1,2,2,0) "cnt" ,count(decode
(dept_id,1,1,2,2,0))
from deps group by decode(dept_id,1,1,2,2,0);
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between union and union all command?
What is sql basics?
What has stored procedures in sql and how we can use it?
How subquery works in sql?
What is plpgsql language?
What is having clause in sql?
What is clause?
What does cursor do in sql?
Is oracle sql free?
define data blocks ? : Sql dba
What are field types?
Which kind of parameters cannot have a default value in pl sql?
What are the two types of cursors in pl sql?
Which join is like inner join?
what is an execution plan? When would you use it? How would you view the execution plan? : Sql dba