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 action do you have to perform before retrieving data from the next result set of a stored procedure ?

2609


What is the requirement of self-join?

1206


what are the advantages and disadvantages of cascading style sheets? : Sql dba

1102


What is the difference between sql and t sql?

1103


how can we encrypt and decrypt a data present in a mysql table using mysql? : Sql dba

1239


Which are the different case manipulation functions in sql?

1075


What is case function?

1089


What are all the ddl commands?

1240


Can we join 3 tables in sql?

1106


Can we create foreign key without primary key?

1036


What is the use of index in hive?

1052


Which command is used to delete a package?

1232


How to connect a sql*plus session to an oracle server?

1173


What is meant by <> in sql?

1026


What is the reports view in oracle sql developer?

1039