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 user defined datatypes? : Sql server database administration

923


Why is there a performance difference between two similar queries where one uses union and the other uses union all?

983


Sql server reporting services vs. Crystal reports.

118


What is constraints and its types?

876


Do you know what is fill factor and pad index?

940


What are the different types of collation sensitivity?

1055


What are group functions in query statements in ms sql server?

950


What are a scheduled jobs?

908


What do you understand by mirroring and mention the advantages of the mirroring?

1008


What is thr feature of change data capture?

919


What is 1nf 2nf and 3nf?

844


How to modify the underlying query of an existing view?

931


What’s the distinction between dropping a info and taking a info offline?

992


What is field with example?

869


Explain datetimeoffset data type in sal server 2008?

850