I have a following table (a simplified example, in fact the table contains multiple IDs, with variable numbers of dates, and variable number of events for each date):
IDs Date Event
102 1996-10-16 00:00:00 A
102 1996-10-23 00:00:00 A
102 1996-10-23 00:00:00 B
102 1997-01-14 00:00:00 A
103 1997-01-14 00:00:00 D
103 1997-01-15 00:00:00 A
103 1997-01-16 00:00:00 A
103 1997-01-16 00:00:00 B
103 1997-01-16 00:00:00 C
I am trying to get a table where I will have distinct IDs/Date pairs, with the rows for which there have been multiple events recoded being transposed into columns. So, I'm looking for a table which for this example would look like this:
IDs Date Event Event2 Event3
102 1996-10-16 00:00:00 A NULL NULL
102 1996-10-23 00:00:00 A B NULL
102 1997-01-14 00:00:00 A NULL NULL
103 1997-01-14 00:00:00 D NULL NULL
103 1997-01-15 00:00:00 A NULL NULL
103 1997-01-16 00:00:00 A B C
I'm sorry for not posting any code, but I frankly don't even know how to start with this.