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 is the syntax to execute the sys.dm_db_missing_index_details?
What are the 3 types of schema?
What is fill factor and pad index?
What is function of CUBE ?
Can we insert data into view sql server?
What are partitioned views?
How to enter binary string literals in ms sql server?
Different types of keys in SQL?
explain what is raid and what are different types of raid configurations? : Sql server database administration
What is sql server used for?
how many clustered indexes can be created on a table? : Sql server database administration
What are actions, how many types of actions are there, explain with example? : sql server analysis services, ssas
What is the native system stored procedure to execute a command against all databases?
Why I am getting this error when renaming a database in ms sql server?
How to create a store procedure with encryption?