how to change column into row in sql
Answers were Sorted based on User's Feedback
Answer / kapil
With the help of pivot table in sql server 2005 we can do so
| Is This Answer Correct ? | 22 Yes | 5 No |
Answer / vishal
with the help of pivoting....
it will solve the problem of grouping also
| Is This Answer Correct ? | 0 Yes | 0 No |
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 |
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 |
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?
what is index seek and index scan?
List all types of constraints in sql server?
what is a self join? : Sql server database administration
Describe in brief databases and sql server databases architecture.
Rate yourself in .NET and SQL ?
1 Answers Cognizant, HCL, SunGard,
How can I create a new template for import ? : sql server management studio
What is serializable?
What are triggers? How do you invoke a trigger on demand?
how to take backup bcp out for a column in table in sql server?
Is profiler the only tool that has the ability to audit and identify ddl events? : sql server security
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)