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


how to change column into row in sql

Answers were Sorted based on User's Feedback



how to change column into row in sql..

Answer / kapil

With the help of pivot table in sql server 2005 we can do so

Is This Answer Correct ?    22 Yes 5 No

how to change column into row in sql..

Answer / vishal

with the help of pivoting....
it will solve the problem of grouping also

Is This Answer Correct ?    0 Yes 0 No

how to change column into row in sql..

Answer / samba shiva reddy . m

creating pivot table:
Columns as Rows

below statement will give as it is data

select
PS.Name, P.Color, PIn.Quantity
from Production.Product P
inner join Production.ProductSubcategory PS
on PS.ProductSubcategoryID = P.ProductSubcategoryID
left join Production.ProductInventory PIn
on P.ProductID = PIn.ProductID
This statement will change the columns as rows

select
*
from
(
select
PS.Name, P.Color, PIn.Quantity
from Production.Product P
inner join Production.ProductSubcategory PS
on PS.ProductSubcategoryID = P.ProductSubcategoryID
left join Production.ProductInventory PIn
on P.ProductID = PIn.ProductID
) DataTable
PIVOT
(
SUM(Quantity)
FOR Color
IN (
[Black],[Blue],[Grey],[Multi],[Red],
[Silver],[Silver/Black],[White],[Yellow]
)
) PivotTable

Is This Answer Correct ?    2 Yes 4 No

how to change column into row in sql..

Answer / sai

I agree with this answer..and also we can do the pivot
transaformation in SSIS.

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More SQL Server Interview Questions

After using delete statement in sql query to delete some records...to retrieve the deleted records we can get using rollback command but till that where it stores means particular location name i need....(after deleting and rollback )

3 Answers   CarrizalSoft Technologies, iGate,


Explain important index characteristics?

0 Answers  


what is index seek and index scan?

2 Answers  


List all types of constraints in sql server?

0 Answers  


what is a self join? : Sql server database administration

0 Answers  


Describe in brief databases and sql server databases architecture.

0 Answers  


Rate yourself in .NET and SQL ?

1 Answers   Cognizant, HCL, SunGard,


How can I create a new template for import ? : sql server management studio

0 Answers  


What is serializable?

0 Answers  


What are triggers? How do you invoke a trigger on demand?

0 Answers   Hexaware,


how to take backup bcp out for a column in table in sql server?

0 Answers  


Is profiler the only tool that has the ability to audit and identify ddl events? : sql server security

0 Answers  


Categories