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

what is the difference between union and union all? : Sql dba

976


Is t sql a programming language?

1007


How do I access sql anywhere database?

921


What is sql keyword?

946


What is cursor status?

1135


What operating systems are supported by oracle sql developer?

904


Explain dml and ddl?

923


Why schema is used in sql?

987


What are actual parameters and formal parameters?

1039


What is compilation error in pl sql?

921


What mean sql?

954


what are the maximum number of rows that can be constructed by inserting rows directly in value list? : Transact sql

906


How do I view a procedure in sql?

913


What is difference between cursor and trigger?

1021


What is cross join example?

942