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 / prg

SELECT Sum([1]) AS Jan, Sum([2]) AS Feb, Sum([3]) AS Mar,Sum([4]) as Apr,Sum([5]) as May,Sum([6]) as Jun,

Sum([7]) as Jul,Sum([8]) as Aug,Sum([9]) as Sep,Sum([10]) as Oct,Sum([11]) as Nov,Sum([12]) as Dec

FROM (SELECT Month(JoinDate) as Mon

FROM AAA) ps

PIVOT

(Count(Mon) FOR Mon IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) AS pvt

group by [1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12]

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List the different types of collation sensitivities in sql server?

1042


Explain what are the database objects? : SQL Server Architecture

1068


Define normalisation?

1102


What are sql server procedures?

967


Differentiate between ms sql server reporting services vs crystal reports?

893


What are the benefits and tasks of object explorer? : sql server management studio

1171


What is a sql join?

1009


What is the order in which the sql query is executed?

934


What are different types of raid levels?

1158


If a user does not have permission to a table, but has permission to a view created on it, will he be able to view the data in table?

932


How can we delete Duplicate row in table?

1051


Explain primary key in sql server?

1012


What is the current pricing model of SQL Azure?

104


How to apply cascading referential integrity in place of triggers?

1025


hi i am working as a testengineer , so i want to no the backend data base connection can any one tell mwe in detail

2211