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 / ramadass

select classname,count(*) from students group 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 isolation levels?

574


What number sorts of privileges are accessible in sql?

600


What is the use of set nocount on/off statement?

629


Explain the concepts and capabilities of sql server?

547


What is the difference between Normalization and De-normalization?

569






How to scale out a federation by Sql statement?

92


List out the differences between global and local temp tables in sql server?

584


What are the benefits and tasks of object explorer? : sql server management studio

615


How to view existing indexes on an given table using sp_help?

606


When we should use @@error?

548


What is impersonation? What are the different impersonation options available in ssas? : sql server analysis services, ssas

556


Can we perform backup restore operation on tempdb? : sql server database administration

594


What are sub reports?

156


What is difference between clustered and non clustered index?

539


What are the types of database recovery models?

605