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

What is using in sql?

1091


how can we destroy the session, how can we unset the variable of a session? : Sql dba

998


How can you create an empty table from an existing table?

1079


What are different types of tables in sql?

998


What is the use of partition by in sql?

995


What normalization means?

978


How to move files from one directory to another in pl sql?

1194


What is nvarchar in sql?

924


what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba

1044


What is sql integrity?

1157


What are aggregate and scalar functions?

1023


What is the difference between cross join and natural join?

1022


What is the difference between distinct and unique in sql?

948


What is difference between table and view?

1056


What are the limitations of sql express?

1069