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 sql servers used for?
Is it safe to delete log files?
How will you make an attribute not process? : sql server analysis services, ssas
Can foreign key be deleted?
How to turn off warning messages during php execution?
Can we use where clause in union?
What are the advantages of partitioning?
Explain acid?
What are the different editions available in sql server 2000?
How column data types are determined in a view?
What are the three different part of rdl file explain them?
How to stop log file growing too big?
Does group by or order by come first?
How do I edit a stored procedure in sql server?
Give an example of SQL injection attack ?