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
Differentiate between a local and a global temporary table?
What is best institute to Learn DotNET And SQL in chennai?
Name few of the dcl commands in sql?
What is collation sensitivity?
What is a partition function in sql server?
How and why use sql server?
What is acid mean in sql server?
What does asynchronous call backs means?
What samples and sample databases are provided by microsoft?
What is table value parameters (tvp)?
Can a stored procedure call itself or recursive stored procedure? How many levels sp nesting is possible?
What is the contrast between sql and pl/sql?
What is the difference between drop table and truncate table?
What is a data source file?
How to count duplicated values in a column in ms sql server?