Solved

Data Pivot - SQL 2008

Posted on 2011-09-27
2
172 Views
Last Modified: 2012-05-12
How do i pivot this output ?

XAxis              YAxis
0.997587025      0.002412974

I need it to be like this:
Coordinates     Values
XAxis               0.997587025
YAxis               0.002412974

0
Comment
Question by:byte1
2 Comments
 
LVL 16

Accepted Solution

by:
vdr1620 earned 500 total points
ID: 36709789
try this

CREATE TABLE PIVOT_Sales(id INT,X_axis INT, Y_Axis INT)
INSERT PIVOT_Sales VALUES(1,11.00, 12.000)
INSERT PIVOT_Sales VALUES(2,10.00, 15.000)

SELECT Axis,location
FROM (SELECT X_Axis,Y_Axis FROM PIVOT_Sales) AS p
UNPIVOT (location for Axis in (X_Axis,Y_Axis)) AS s
0
 

Author Closing Comment

by:byte1
ID: 36709900
Awesome :-)
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
migration MS SQL database to Oracle 30 60
SSRS 2012 r2 - Parm Drop Down has Date/Time 12 31
Sql server function help 15 28
SQL SELECT query help 7 34
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question