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

select col1,count(*) cnt from T1 where col1 in
(select distinct col1 from T1 )
group by col1

Is This Answer Correct ?    1 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how many sql ddl commands are supported by 'mysql'? : Sql dba

1029


What is composite primary key in sql?

1002


What does bitemporal mean?

1074


What happens when a trigger is associated to a view?

916


What is difference between pl and sql?

1068


what is the difference between nested subquery and correlated subquery?

1059


What is a primary key? Explain

983


What is rename command in sql?

1040


How to assign sql query results to pl sql variables?

1087


Can we create a trigger on view?

901


Why is sql*loader direct path so fast?

1110


Can we write dml inside a function in sql server?

961


What is an implicit commit?

1059


How can you tell the difference between an index and a view?

938


what are all types of user defined functions? : Sql dba

1043