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 is data source in connection string?

958


What is BCP? When does it used in sql server 2012?

1108


How to disable stored procedure sql server?

1671


What is executereader?

1005


What is store procedure? When do you use?

987


What is the definition for sql server 2000?

1141


On a windows server 2003 active – passive failover cluster, how do you find the node which is active?

1251


Can you tell me some of the common replication dmv's and their use? : sql server replication

978


List some major differences between triggers and stored procedures?

980


What is transaction server explicit transaction?

1089


Explain triggers in sql?

1004


What is database isolation in sql server? : sql server database administration

1159


Explain the relational database management system (rdbms)?

1162


What are extended events in sql server?

1009


What are the disadvantages of merge replication?

1514