I had a look at this topic: ERROR: Unsupported PIVOT column type: text but unfortunately it didn't provide me with an answer.
I have a simple table that looks like the following:
user_id | type | reminder_type | sent_at
----------------------------------------------------
user_a | MID | REMINDER_1 | 2022-02-01 15:00:00
user_a | MID | REMINDER_2 | 2022-02-15 06:00:00
Then I try to perform this query:
SELECT
*
FROM table
PIVOT (
MIN(sent_at) FOR reminder_type IN('REMINDER_1', 'REMINDER_2')
)
In order to get the following result:
user_id | type | reminder_1 | reminder_2
----------------------------------------------------------
user_a | MID | 2022-02-01 15:00:00 | 2022-02-15 06:00:00
And it gives me the aforementioned error:
Can't get my head wrapped around it and AWS documentation doesn't provide any details about the error