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

Can you join views in sql?

951


What do we need to check in database testing?

1017


How do I run pl sql in sql developer?

1114


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

987


What is the process of copying data from table a to table b?

1087


Mention what is the use of function "module procedure" in pl/sql?

1047


What is view? Can we update view

1434


what are the advantages a stored procedure? : Sql dba

975


Can you call pl/sql package functions from within a fast formula?

1036


how can we transpose a table using sql (changing rows to column or vice-versa) ? : Sql dba

947


What are pl/sql cursor exceptions?

1101


What are the triggers associated with image items?

1041


what are the drivers in mysql? : Sql dba

1018


Is pl sql different from sql?

992


What is trigger price?

984