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 types of Joins are possible with Sql Server?

1101


Distinguish between commit and rollback?

941


What is exporting and importing utility?

1057


What is a field in a table?

1020


What is primary key index?

965


What is collation sensitivity?

1039


What is a self join in sql server?

1110


what is a transaction and what are acid properties? : Sql server database administration

1007


Do you know the capabilities of cursors?

1132


Write a SQL query in order to merge two different columns into single column?

1023


What are the advantages of the mirroring?

1059


How do you identify a foreign key?

1009


What are differences in between sql server 2012 and sql server 2016?

1024


What is difference between primary key and foreign key?

884


What is the boxing and unboxing concept in .net?

901