teradata sql pivot multiple occurrences into additional columns
问题 I have something like this: ID Result 1 value1 2 value1 2 value2 3 value1 4 value1 4 value2 4 value3 And I'd like to return something like this: ID Result1 Result2 Result3 1 value1 2 value1 value2 3 value1 4 value1 value2 value3 I've searched on pivots and concats and breaks and I just can't find a simple, sensible solution. TIA 回答1: Unfortunately Teradata doesn't have a PIVOT function but you can use an aggregate function with a CASE expression to get the result. select id, max(case when seq