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 data source in connection string?
What is BCP? When does it used in sql server 2012?
How to disable stored procedure sql server?
What is executereader?
What is store procedure? When do you use?
What is the definition for sql server 2000?
On a windows server 2003 active – passive failover cluster, how do you find the node which is active?
Can you tell me some of the common replication dmv's and their use? : sql server replication
List some major differences between triggers and stored procedures?
What is transaction server explicit transaction?
Explain triggers in sql?
What is database isolation in sql server? : sql server database administration
Explain the relational database management system (rdbms)?
What are extended events in sql server?
What are the disadvantages of merge replication?