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

select decode(col1,'a','a','b','b','Other') "col1",count
(col1) "countval"
from col group by col1;

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the popular database management systems in the it industry?

980


Is it important to partition hard disk?

1005


How to pronounce postgresql?

1033


What is the use of primary key?

996


How to return multiple rows from the stored procedure?

954


define data blocks ? : Sql dba

969


What is online transaction processing (oltp)?

1004


Why is partition used in sql?

1105


Can we call procedure in select statement?

1039


What are analytic functions in sql?

1008


what is 'mysqlcheck'? : Sql dba

994


what is sql in mysql? : Sql dba

1176


How would you convert date into julian date format?

989


How can we connect an Android App to an Oracle database and use the PL/SQL procedural code?

1124


Why partition by is used in sql?

1015