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

Is sql pronounced sequel or sql?

1260


What is difference between ms sql and mysql?

959


Explain the difference between sql and mysql.

1058


Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?

1096


Why is a trigger used?

938


What is denormalization in a database?

1052


describe transaction-safe table types in mysql : sql dba

1001


Can instead of triggers be used to fire once for each statement on a view?

962


i have 2 table table one 4 columns respective values a1 7,a2 6,a3 8 ,a4 12 & table two 4 colums respective values a1 7,a2 6,a3 8,a4 15.if table one & table two 3 colums same then 4th column values 1)Qes diff >5 then print 5 * diff value 2)Que diff <5 print 5

4021


Why stored procedure is faster than query?

1054


What are the different types of a subquery?

1044


What will you get by the cursor attribute sql%found?

961


What happens when a trigger is associated to a view?

907


What do you mean by dbms? What are its different types?

1012


What is a recursive join sql?

1065