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 / vinu

select decode (col1,'a','a','b','b','others') col1,count(col1) from T1 group by decode (col1,'a','a','b','b','others')

Is This Answer Correct ?    9 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is a PL/SQL code compiled?

1204


What is the difference between partitioning and sharding?

989


what is the difference between ereg_replace() and eregi_replace()? : Sql dba

1129


What is sql catalog?

999


How will you distinguish a global variable with a local variable in pl/sql?

1131


What is the purpose of design view?

998


How to order siblings in oracle hierarchy queries?

1021


Can a foreign key have a different name?

932


How many tables can a sql database have?

958


What is range partitioning?

945


What are expressions?

990


How can we make an if statement within a select statement?

997


Can we use update in sql function?

1045


How delete all records from table in sql?

958


What is the difference between rename and alias?

1325