PIVOT Feature unsure if available?

Database
Enthusiast

PIVOT Feature unsure if available?

HI,

I've been trying to Transpose some data and I think PIVOT is the best option after many other options I've tried.

Can someone tell me if I have PIVOT or not.

I've attached the details from the Help >> About info below.

Also, I've tried the below code and got this error?

"SELECT Failed, 3707 (Syntax error expected something like ',' between the word PIVOT and the '('"

This is a work PC & doesn't use a VM, it has Windows 7 SP1.

I noticed that the word PIVOT is Grey instead of Blue, but the errors I get don't exactly state that it doesn't understand what PIVOT is?

Could someone please advise?

Thanks

 

TD_Version.PNG

 

CREATE TABLE s1(yr INTEGER, mon VARCHAR (5), sales INTEGER);
-----------------------------------------------------------
Table that is used to run the Pivot Function
------------------------------------------------------------
SELECT * FROM s1;
yr      mon      sales
-----   ---      -----
2001    Jan       100
2003    Jan       300
2002    Jan       150
2001    Feb       110
2003    Feb       310
2002    Feb       200
2001    Mar       120
2002    Mar       250
----------------------------------------------------------
SELECT * FROM s1 
PIVOT (SUM (sales) 
FOR mon in 
(SELECT mon FROM s2)) dt;
----------------------------------------------------------
Query output;
         yr        'Feb'        'Jan'        'Mar'
-----------  -----------  -----------  -----------
       2001          110          100          120
       2003          310          300           ?
       2002          200          150          250
---------------------------------------------------------


Accepted Solutions
Teradata Employee

Re: PIVOT Feature unsure if available?

The keyword PIVOT appeared in 16.00 of Database Version.

Here, your Teradata Database is version 14.10.

You can still code the classic way, with sum(case when ...).

 

1 ACCEPTED SOLUTION
3 REPLIES 3
Teradata Employee

Re: PIVOT Feature unsure if available?

The keyword PIVOT appeared in 16.00 of Database Version.

Here, your Teradata Database is version 14.10.

You can still code the classic way, with sum(case when ...).

 

Highlighted
Enthusiast

Re: PIVOT Feature unsure if available?

Thanks Waldar,

So it's the 'Database Version' that I should be checking.

Cheers Peter

Enthusiast

Re: PIVOT Feature unsure if available?

I downloaded this version from the below site.

http://downloads.teradata.com/download/tools/teradata-tools-and-utilities-windows-installation-packa...

What should I download to be able to use the PIVOT function?

I can't see any database Versions to ensure I get the right one??