Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / manoj pandey

select 'No of students in class ' + cast(classname as char(2)) + ' : ' + cast(count(*) as char(5)' from students group by classname


For more Interview Questions check my blog: http://sqlwithmanoj.wordpress.com/interview-questions/

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of columns types constraints in the sql server?

1059


What is the difference between function and stored procedure in sql server?

1044


What is transactional replication?

944


When should you use an instead of trigger?

945


Explain about Joins?

969


How are the unique and primary key constraints different?

1045


What is Replication?

1027


You want your report to display a hyperlink that will take users to your intranet. How do you configure such a hyperlink?

310


What are the kinds of subquery?

998


What is report subscription?

123


Explain the concept of view and Types of views in SQL server?

971


What is auditing in sql server?

912


What is the user of Primary key?

961


Explain the xml support sql server extends?

1023


In how many ways you can invoke ssrs reports?

137