Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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


Please Help Members By Posting Answers For Below Questions

how to get @@error and @@rowcount at the same time? : Sql dba

1082


Why stored procedure is better than query?

1001


What is program debugging?

1342


What is blind sql injection?

1165


What is the difference between an inner and outer join?

1059


what are date and time intervals? : Sql dba

1105


How to install oracle sql developer?

1097


What is a parameter query?

1143


what is the functionality of the function htmlentities? : Sql dba

1006


What is procedure function?

1124


Explain the working of primary key?

1154


Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.

1088


Which command is used to call a stored procedure?

1052


How to run pl/sql statements in sql*plus?

1146


Why is sql better than hql?

1062