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

Give an example of why you would want to denormalize a database

527


How to execute a sql statement using odbc_exec()?

576


What is table value parameters (tvp)?

553


What is user-defined inline table-valued function?

523


How to make a remote connection in a database?

542






What are the instances when triggers are appropriate?

529


What is a ddl statement?

518


what is normalization? : Sql server database administration

543


How to update a field in SQL after ALTERING a row?

694


What is Dependency Injection and provide example?

626


Tell me what are the advantages of using stored procedures?

576


Explain the architecture of ms sql reporting service?

538


How to filter records of table in SQL SERVER?

605


What are the properties of sub-query?

589


What is ms sql server index?

569