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 do you understand by change data capture?
What do you mean by sql server agent?
What is the sql case statement used for? Explain with an example?
What is catalog views?
What is ssrs?
Can we call stored procedure in trigger?
Who is the owner of a schema in ms sql server?
What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting is possible?
What is the need for group functions in sql?
How to drop an existing table?
What is a field in a table?
You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?
What is intellisense?
Where is trigger in sql server?
Explain what are partitioned views and distributed partitioned views?