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

Is left join inner or outer?

1006


What is bulk collect in pl sql?

1079


What are the differences between implicit and explicit cursors?

1053


What are the different types of tables in sql?

977


What is pivot table in sql?

1087


Enlist the data types that can be used in pl/sql?

1052


Is it important to partition hard disk?

1008


How do you optimize a query?

980


What is the basic form of sql query?

927


Can we use threading in pl/sql?

1025


What is error ora-12154: tns:could not resolve the connect identifier specified?

1058


When a dml statement is executed, in which cursor attributes, the outcome of the statement is saved?

1096


What are the benefits of triggers?

1161


Is sql easier than java?

994


Can we update views in sql?

927