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 to extract a unit value from a date and time? : Sql dba

1042


What is a constraint?

1085


Does sap use sql?

1042


How to fix oracle error ora-00942: table or view does not exist

1084


what are the authentication modes in sql server? How can it be changed? : Sql dba

1514


What is sql indexing?

1065


What are the types of subqueries?

1103


What is the maximum size of sqlite database?

1156


What is the difference between count 1 and count (*) in a sql query?

1056


Do foreign keys improve performance?

1068


What is pl sql commands?

1098


What will you get by the cursor attribute sql%rowcount?

1077


what is the difference between char_length and length? : Sql dba

1117


Explain the uses of a database trigger?

1089


What are predefined functions in sql?

1109