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

Explain ttitle and btitle.

1104


How many sql core licenses do I need?

928


What is row_number () in sql?

963


What is record variable?

960


What is a nested table in word?

944


Which normal form is best?

934


what is the difference between clustered and non clustered index in sql? : Sql dba

1105


What is percent sign in sql?

1263


Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql

963


What are different sql data types?

1014


what are the 'mysql' command line arguments? : Sql dba

1120


Can we join more than 2 tables in sql?

1000


differentiate between float and double. : Sql dba

1036


How do you declare a user-defined exception?

1004


Why plvtab is considered as the easiest way to access the pl/sql table?

1193