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

select decode(dept_id,1,1,2,2,0) "cnt" ,count(decode
(dept_id,1,1,2,2,0))
from deps group by decode(dept_id,1,1,2,2,0);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is myisam? : Sql dba

1060


what is isam? : Sql dba

990


what are the differences between get and post methods in form submitting. Give the case where we can use get and we can use post methods? : Sql dba

1118


What is sql trigger example?

1035


How many types of cursors supported in pl/sql?

1162


What are the properties of a transaction?

1121


What are the different datatypes available in PL/SQL?

1068


Which join condition can be specified using on clause?

942


What is the order of sql select?

1035


how to include numeric values in sql statements? : Sql dba

1086


What is difference sql and mysql?

966


If a cursor is open, how can we find in a pl/sql block?

1151


What is assignment operator in pl sql?

1018


How do you update f as m and m as f from the below table testtable?

1835


What is the difference between nvl function, ifnull function, and isnull function?

1089