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 col1;

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do ddl statements need commit?

1023


Which function is used to return remainder in a division operator in sql?

1203


What is hibernate and its relation to sql?

1171


How much does sql cost?

1067


what are the types of subquery? : Sql dba

1161


How to write a query to show the details of a student from students table whose

1063


What is triggering circuit?

1108


Which is better varchar or nvarchar?

1053


How to run pl sql program in mysql?

1073


What is the difference between nested table and varray?

1052


define sql insert statement ? : Sql dba

1080


What is difference sql and mysql?

1038


What are the set operators in sql?

1138


What are the operators in sql?

1070


Show how functions and procedures are called in a pl/sql block.

1188