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...

i have table students with fields classname,studname
select * from students
classname studname
1 xxxxx
1 yyyy
1 zzzz
2 qqqq
2 tttt
3 dsds
3 www
i want the output should be

No of students in class 1 : 3
No of students in class 2 : 2
No of students in class 3 : 2

Answer Posted / samba shiva reddy . m

select 'No of students in class '+ CONVERT(VARCHAR,ClassName)+' : '+ convert(varchar,Count(studname)) from students
group by
classname order by classname

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the default port for SQL Server over a firewall?

1045


Write a query to find 5th highest amount paid from the customer table.

896


What is change tracking in sql server?

956


What are diverse clauses that form a part of sql?

1035


How to provide default values to stored procedure parameters?

1019


Explain collation?

1015


Do you know spatial data types - geometry and geography in sql server 2008?

975


What is an execution plan? When would you use it?

932


What is the purpose of a table?

922


what are constraints? : Sql server database administration

1000


How to make a remote connection in a database?

937


Explain various data region available in ssrs with their use?

890


is there a column to which a default can't be bound? : Sql server database administration

980


Is mysql better than sql server?

1021


Can you explain full-text query in sql server?

980