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

what is csv? : Sql dba

946


What is the difference between joins?

977


What is the file extension for sql database?

939


How do you optimize a stored procedure in sql?

896


What are the different sql commands?

1003


what is sub-query? : Transact sql

1041


what are the non-standard sql commands supported by 'mysql'? : Sql dba

1045


what is sql in mysql? : Sql dba

1123


What is the difference between left and left outer join?

894


What are different categories of sql commands?

1070


What is a memo field?

903


What is memory optimized table?

986


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

928


Mention what are the benefits of pl/sql packages?

1001


What is the difference between local variables and global variables?

1071