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 / samba shiva reddy . m
select 'No of students in class '+ CONVERT(VARCHAR,ClassName)+' : '+ convert(varchar,Count(studname)) from students
group by
classname order by classname
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is the language structure to add a record to a table?
How to delete duplicate rows in sql server?
What happens if null values are involved in boolean operations?
Does table partitioning improve performance?
Explain why variables called the most powerful component of ssis?
What is the difference between inner join and equi join?
What is difference between sql and sql server?
Explain different types of self contained sub query?
Explain boyce and codd normal form(bcnf)?
Explain iaas, paas and saas?
Why use view instead of a table?
How does normalization work?
Explain the working of sql privileges?
How do I delete a sql server database?
Mention the different types of replication in sql server.