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 / debasish

select classname,count(studentname) from students group by
classname

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is difference between equi join and natural join?

712


What are sql azure firewall rules?

97


Which are new data types introduced in sql server 2008?

810


Define full outer join?

702


What are the difference between clustered and a non-clustered index?

757






Where are sql server user names and passwords stored in sql server?

734


What is linked report?

104


what stored procedure can you use to display the current processes? : Sql server administration

719


Hi all, can any one please tell me the difference between sql server 2008 and orace 9i

1718


Can you get second highest salary from the table?

724


What are data resources?

664


What is the contrast amongst drop and truncate?

756


What is the use of keyword with encryption.

783


How do I determine how many instances of sql server are installed on a computer?

715


What is database dimension? : sql server analysis services, ssas

836