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 / debasish
select classname,count(studentname) from students group by
classname
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
How to disconnect from a sql server using mssql_close()?
What is "scheduled jobs" or "scheduled tasks"?
What are the properties of sub-query?
How to enable tcp/ip protocol on a sql server?
What is for xml in sql server?
Can binary strings be converted into numeric or float data types?
In how many ways you can invoke ssrs reports?
Where sql server user names and passwords are stored in sql server? : sql server database administration
how to create “alternate row colour”?
What are distributed partitioned views?
What is difference between inner join and full join?
Is it possible to update the views? If yes, how, if not, why?
What is identity?
Can we use pragma autonomous_transaction in trigger?
Explain different types of locks in sql server.