[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Data Pivot - SQL 2008

Posted on 2011-09-27
2
Medium Priority
?
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
vdr1620 earned 2000 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

650 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