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 decode(col1,'a','a','b','b','Other');

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to prepare for oracle pl sql certification?

1109


What are the topics in pl sql?

1024


What is sqlca in db2?

1037


what are the 'mysql' command line options? : Sql dba

1135


How do you optimize a query?

1060


is mysql query is case sensitive? : Sql dba

1164


What is sql*loader?

1285


What is difference between mysql and postgresql?

1238


What is a recursive stored procedure?

1253


what are the advantages and disadvantages of cascading style sheets? : Sql dba

1105


What is package in pl sql with an examples?

1089


what is oracle database ? : Sql dba

1080


Why do we use %rowtype & %type in plsql?

1100


Is it possible to include an insert statement on the same table to which the trigger is assigned?

1065


Is and as keyword in pl sql?

1014