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
Can we use where clause in union?
Explain partitioned view?
What is reference section?
What is clustered index
How to create a view using data from another view?
What does it mean to normalize a database and why would you do it?
What is database architecture? : SQL Server Architecture
Explain about merge replications?
What is default constraint in ms sql server?
Can a table have 2 primary keys?
What is raid? : SQL Server Architecture
difference between Clustered index and non clustered index ?
What are indexes in ms sql server?
What is left outer join in sql server joins?
What command would you use to create an index?