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 / rakesh prasad

select name ,count(name)as cnt from (
select case when ((name ='a') or (name = 'b') )then name
else
'others' end as 'name' from tbl_count ) as temp group by
name

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where the sql database files are stored?

1081


Is it possible to read/write files to-and-from PL/SQL?

1151


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

1078


write an sql query to find names of employee start with 'a'? : Sql dba

1089


What is full join?

1023


What are functions in sql?

998


how are mysql timestamps seen to a user? : Sql dba

1199


When can we use the where clause and the having clause?

1087


How do I view tables in mysql?

1032


What is the reports view in oracle sql developer?

1046


If i can use sys.check_constraints to display my constraints from my database using sql server 2005, how can i display then if i am using sql server 2000????

4062


What is difference between ms sql and mysql?

1017


Mention what are the benefits of pl/sql packages?

1159


What does := mean in pl sql?

1091


What is a variable in sql?

1055