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
What is snapshot report?
What are the different methods available under sqlcommand class to access the data?
what is the main function of a query parameter?
Where cross join is used?
Can you please differentiate between a primary key and a unique key?
What is multi-statement table-value user-defined function?
Why do we need different type of parameter?
What is a with(nolock)?
Why do we use stored procedures in sql server?
Does any body please help me what question's have asked for SSRS in the interview?
Once setting replication, can you have distributor on sql server 2005, publisher of sql server 2008?
Explain forward - only cursors?
What is lock escalation and what is its purpose?
How to sort the query output with order by clauses in ms sql server?
What are the benefits of filtered indexes?