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...

Table student containing 2 columns,Join date,Employee name.
Under join date 4 rows r ter =1-jan-2008,2-feb-2008,3-mar-
2008,4-feb-2008.Under Employee name 4 difeerent names
jaison,robin,binoy,rahul

Result set is,
Table containing 4-column name=jan,feb,mar,april,,beneath
these months count is given as 1,2,1,0 means these counts
representing number of emplooyees joined in a month(january
1employee,february 2 employee,march 1 employee,april 0
employee)

Can you give me the required sql query

Answer Posted / soorai ganesh

Hi dude, If u use SQLSERVER 2005 this will help u.......
-------------------------------------------------------

Create table student (studName varchar(50), doj smalldatetime)
insert into student values('Ganesh','05/26/2008')
insert into student values('Ramesh','03/26/2008')
insert into student values('Dinesh','03/26/2008')
insert into student values('Suresh','04/26/2008')

Select * from student

SELECT 'Students Admission by Monthwise',[3] AS March,[4] AS April,[5] AS May
FROM(
SELECT studName,
Month(doj) monthname
FROM student
) A
PIVOT
(
COUNT(studname)
FOR monthname in
([3],[4],[5])
) AS PVT

Is This Answer Correct ?    12 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you have any idea about the tcl commands?

1013


Create a dts package to produce a text file using the ‘update statistics’ command for the tables in a database with obsolete statistics.

1098


what are the reporting service components in SSRS?

170


What are the different types of backups that exist?

1221


Which are the third-party tools used in sql server and why would you use them?

959


Is BCNF better than 2NF & 3NF? Why?

1104


What is dimension table? : sql server analysis services, ssas

1065


How to find the source of a table in sql server?

1037


What is database dimension? : sql server analysis services, ssas

1139


1.how to find the dead lock in sql server? 2.How to fine the memory leaks in sql server? 3.suppose transaction log file increasing what action will take ?

2077


You want to implement the many-to-many relationship while designing tables. How would you do it?

1046


How to divide query output into multiple groups with the group by clause in ms sql server?

1088


List the different index configurations possible for a table?

979


What is triggers and its types?

1066


What is advantage data architect?

975