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 the steps to process a single select statement?
Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?
What is 1nf 2nf?
What is the contrast between sql and mysql?
How to execute a stored procedure in ms sql server?
How to retrieve field values using mssql_result()?
Why should we go for stored procedures? Why not direct queries?
What are the different types of sql server replication? : sql server replication
What is the most common type of join?
State a few properties of relational databases?
What are the restrictions while creating batches in sql server?
What are the limitations/drawbacks or ssrs 2008 r2?
can you implement data mining in SSRS?
how to determine the service pack currently installed on sql server? : Sql server database administration
What are the disadvantages of indexes?