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
Why do we use sql constraints?
How do I enable sql encryption?
What is sql and how does it work?
How many primary keys can a table have?
What is the difference between null value, zero, and blank space?
What is the difference between inner join and outer join?
What is sql lookup?
What are the parts of a sql statement?
How many sql statements are used?
how to include character strings in sql statements? : Sql dba
What is an implicit commit?
What is 19 null in sql?
How do you rename a table in sql?
What is a primary key called that is made up of more than one field?
Why do we create views in sql?