Erland Sommarskog
unread,Apr 12, 2020, 7:59:11 AM4/12/20You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
SELECT PE.TestID,
MIN(CASE PU.PresentOrder WHEN 1 THEN PE.TextValue END) AS Param1,
MIN(CASE PU.PresentOrder WHEN 2 THEN PE.TextValue END) AS Param2,
MIN(CASE PU.PresentOrder WHEN 3 THEN PE.TextValue END) AS Param3,
MIN(CASE PU.PresentOrder WHEN 4 THEN PE.TextValue END) AS Param4,
MIN(CASE PU.PresentOrder WHEN 5 THEN PE.TextValue END) AS Param5
FROM ParametersEntries PE
JOIN ParametersUser PU ON PE.TestID = PU.TestID
GROUP BY PE.TestID
You may note that I don't use the PIVOT keyward. The above method with CASE
is a lot more flexible and easier to understand.