Question: Please re-write below query in Teradata with pivot. SELECT SuggestionID , [1] AS 'Tag 1' , [2] AS'Tag 2' [3] AS 'Tag 3 , [4]

Please re-write below query in Teradata with pivot.Please re-write below query in Teradata with pivot. SELECT SuggestionID , [1]

SELECT SuggestionID , [1] AS 'Tag 1' , [2] AS'Tag 2' [3] AS 'Tag 3 , [4] AS 'Tag 4 [5] AS Tag 5 FROM ( SELECT ROW_NUMBER() OVER(PARTITION BY st.suggestionid ORDER BY st. suggestionid, st.ID ASC) AS SuggestionTagNum , st.suggestionid ,t.tag FROM CRPBP.LoudSpeaker.LS_SuggestionTag st INNER JOIN CRPBP.LoudSpeaker.LS_Tag t ON st.TagID = t.ID ) tag PIVOT 1 MIN(tag) FOR SuggestionTagNum IN [[1],[2],[3],[4],[5]) ) As pivoted_tags

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!