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

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

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What the different types of Replication and why are they used?

546


What is page in sql server?

519


How will you hide an attribute? : sql server analysis services, ssas

527


What are ddl triggers and types of ddl trigger?

615


How to write a query with a full outer join in ms sql server?

566






What is the template in sql?

541


Is BCNF better than 2NF & 3NF? Why?

626


What is recompile sql server?

573


What is 1nf normalization form?

601


Is mysql the same as sql server?

515


Why use triggers?

578


Why we need sql server?

565


explain the difference between oracle- sql and sql server sql ? if both are same y we r using 2 sw.s?

1991


can an order by clause be used in a creation of a view?

697


What is the default order of an order by clause?

584