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
how to get @@error and @@rowcount at the same time? : Sql dba
Why stored procedure is better than query?
What is program debugging?
What is blind sql injection?
What is the difference between an inner and outer join?
what are date and time intervals? : Sql dba
How to install oracle sql developer?
What is a parameter query?
what is the functionality of the function htmlentities? : Sql dba
What is procedure function?
Explain the working of primary key?
Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.
Which command is used to call a stored procedure?
How to run pl/sql statements in sql*plus?
Why is sql better than hql?