does sybase IQ support PIVOT/UNPIVOT like SQL server? Date Name salary --- --- ----- 1/1/2012 jay 50 1/1/2012 ken 60 1/2/2012 ken 60 1/2/2012 jay 50 1/3/2012 jay 55 1/3/2012 lisa 80 .... I want to show the result set as following. Date, ken, Jay, Lisa 1/1/2012 60 50 0 1/2/2012 60 50 0 1/3/2012 0 55 80 Is that even possible? |
I can't tell for Sybase IQ, however as IQ uses SQL Anywhere as its front end, I guess the following FAQ might apply to IQ, too: To cite from Breck's answer there:
answered 08 Nov '13, 18:06 Volker Barth |
http://sqlanywhere.blogspot.com/2010/01/crosstab-rotate-pivot.html This may be the answer you need answered 22 Nov '13, 09:10 mfkpie8 |
SQL PIVOT and UNPIVOT are not available in SAP IQ and SAP SQLAnywhere. With SQL PIVOT construct, one can pivot the Salary table as following: DBA.Salary is a base table: Date Name Salary 1/1/2012 Jay 50 1/1/2012 Ken 60 1/2/2012 Ken 60 1/2/2012 Jay 50 1/3/2012 Jay 55 1/3/2012 Lisa 80 SELECT newPivot.* FROM (SELECT Date, Name, Salary FROM DBA.Salary ) AS source PIVOT ( SUM(source.Salary) FOR source.Name IN (‘Ken’ AS KEN, ‘Jay’ AS JAY, ‘Lisa’ AS LISA) ) AS newPivot Date KEN JAY LISA 1/1/2012 60 50 0 1/2/2012 60 50 0 1/3/2012 0 55 80 answered 12 Nov '13, 12:57 Nica _SAP just checking - PIVOT is available in Sybase IQ but not SQL Anywhere, is that right?
(12 Nov '13, 13:07)
Justin Willey
Replies hidden
Thanks for the clarification :)
(13 Nov '13, 05:39)
Justin Willey
|