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 / samba shiva reddy . m

select 'No of students in class '+ CONVERT(VARCHAR,ClassName)+' : '+ convert(varchar,Count(studname)) from students
group by
classname order 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 is an inner join?

1041


When to use null data driven subscription?

213


How do I edit a stored procedure in sql server?

972


what's the difference between a primary key and a unique key? : Sql server database administration

991


What is BCNF? How is it better than 2NF & 3NF?

1066


What is the difference between dbcc indexdefrag and dbcc reindex?

1042


What is hot add cpu in sql server 2008?

986


Explain about link server in sql server?

1118


what is denormalization and when would you go for it? : Sql server database administration

1258


What is replication with database mirroring? : sql server database administration

1152


What is sql server database?

1082


What is Sqlpaging in SqlServer 2005 ?

1115


Explain what are the basic functions for master, msdb, model, tempdb databases?

1031


What is the ‘fillfactor’?

1016


How to generate random numbers with the rand() function in ms sql server?

1228