Q&A about the site for administrators, end users, developers and designers for Craft CMS
CREATE table #yourtable ([Id] int, [CrewName] varchar(15), [EventTime] datetime, [EventCaption] varchar(25)) ; INSERT INTO #yourtable ([Id], [CrewName], [EventTime], [EventCaption]) VALUES (1, 'S Stark', '2021-10-25 13:55:00.000', 'Assigned to outage'), (1, 'S Stark', '2021-10-25 14:00:00.000', 'Leaving Home'), (1, 'S Stark', '2021-10-25 14:15:00.000', 'Arrived on site') ; select 'Assigned to outage', 'Leaving Home', 'Arrived on site' from ( select CrewName, EventTime, EventCaption from #yourtable ) d pivot ( max(EventTime) for EventCaption in (Firstname, Amount, PostalCode, LastName, AccountNumber) ) piv;