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

Show code of a cursor for loop.

1002


how would you write a query to select all teams that won either 2, 4, 6 or 8 games? : Sql dba

1300


Can I call a procedure inside a function?

947


What is a full join?

912


Can we create table in function?

907


what is the difference between char and varchar data types? : Sql dba

1003


Is null operator in sql?

980


what is a control file ? : Sql dba

991


what is the use of double ampersand (&&) in sql queries?

1117


Can I learn sql in a week?

1008


how to present a past time in hours, minutes and seconds? : Sql dba

946


how to include character strings in sql statements? : Sql dba

1001


Mention what is the plv (pl/vision) package offers?

1057


What does (*) mean in sql?

904


How delete all records from table in sql?

930