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
How to implement service broker?
Can a rule be bound to any column of any data type?
How to rename an existing table with the "sp_rename" stored procedure in ms sql server?
How do I open a .db file?
Why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it?
What is difference between getdate and sysdatetime in sql server 2008?
Can we add a cpu to sql server?
What is the difference between Triggers and Stored Procedure?
explain what is raid and what are different types of raid configurations? : Sql server database administration
If you want to send some data from access database to sql server database. What are different component of ssis will you use?
How to generate create function script on an existing function?
Write a Select Query to display title for each group of records, which are collected with Compute Clause? Like titlefield column-A column-B ..... ..... ..... Sum ... titlefield column-A column-B ..... ..... ..... Sum ...
How to list all triggers in the database with sys.triggers in ms sql server?
what stored procedure can you use to display the current processes? : Sql server administration
What are truncate options available in sql server? : sql server database administration