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 myisam? : Sql dba
what is isam? : Sql dba
what are the differences between get and post methods in form submitting. Give the case where we can use get and we can use post methods? : Sql dba
What is sql trigger example?
How many types of cursors supported in pl/sql?
What are the properties of a transaction?
What are the different datatypes available in PL/SQL?
Which join condition can be specified using on clause?
What is the order of sql select?
how to include numeric values in sql statements? : Sql dba
What is difference sql and mysql?
If a cursor is open, how can we find in a pl/sql block?
What is assignment operator in pl sql?
How do you update f as m and m as f from the below table testtable?
What is the difference between nvl function, ifnull function, and isnull function?