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 / soorai ganesh
SELECT 'No of students in class '+ CONVERT
(VARCHAR,ClassName)+' : '+CONVERT(VARCHAR, COUNT(*)) FROM
students GROUP BY classname
| Is This Answer Correct ? | 21 Yes | 0 No |
Post New Answer View All Answers
what are the different types of SSRS reports?
What is truncate table?
What is cte (common table expression)?
What happens if you insert a duplicate key for the primary key column in ms sql server?
What are the events recorded in a transaction log?
How to declare and use cursor variables?
What are acid properties of transaction?
When we should use @@error?
How does recursive cte works in sql server?
What is the use of toad or sqldbx.?
Where actually sql azure database is hosted?
what is the maximum size of a row? : Sql server database administration
What stored procedure would you use to view lock information?
What are null values in ms sql server?
What is right outer join in sql server joins?