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 / soorai ganesh

SELECT 'No of students in class '+ CONVERT
(VARCHAR,ClassName)+' : '+CONVERT(VARCHAR, COUNT(*)) FROM
students GROUP BY classname

Is This Answer Correct ?    21 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the different types of SSRS reports?

153


What is truncate table?

941


What is cte (common table expression)?

1032


What happens if you insert a duplicate key for the primary key column in ms sql server?

977


What are the events recorded in a transaction log?

1000


How to declare and use cursor variables?

1172


What are acid properties of transaction?

949


When we should use @@error?

970


How does recursive cte works in sql server?

1016


What is the use of toad or sqldbx.?

1156


Where actually sql azure database is hosted?

163


what is the maximum size of a row? : Sql server database administration

1015


What stored procedure would you use to view lock information?

976


What are null values in ms sql server?

1089


What is right outer join in sql server joins?

1181