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 / vinu

select decode (col1,'a','a','b','b','others') col1,count(col1) from T1 group by decode (col1,'a','a','b','b','others')

Is This Answer Correct ?    9 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain locks? : Transact sql

1010


Explain exception handling in pl/sql?

1038


What is a join query?

965


How many types of triggers exist in pl/sql?

1074


What are the types of keys?

996


Who developed sql?

1049


What is the difference between microsoft access and sql server?

1060


how can you see all indexes defined for a table? : Sql dba

1000


How are sql commands classified?

1090


who introduced sql?

1023


what is the use of set statement in tsql? : Transact sql

1011


What is difference between stored procedures and application procedures?

1013


How do you determine the current isolation level? : Transact sql

1159


How do I start pl sql?

949


what happens if null values are involved in expressions? : Sql dba

1045