-2

I have the challenge to query a sql server label with the follow context:

enter image description here

to get a result like this:

enter image description here

Does anybody have an idea how to implement the sql query?

I tried to use the sql pivot function without good results.

Thank you in advance!

Zhorov
  • 28,486
  • 6
  • 27
  • 52
  • 1
    Please, edit the question and add your current attempt. – Zhorov Feb 22 '23 at 13:49
  • 1
    [Please do not upload images of code/data/errors when asking a question.](//meta.stackoverflow.com/q/285551) – Thom A Feb 22 '23 at 13:50
  • 1
    Does this answer your question? [Efficiently convert rows to columns in sql server](https://stackoverflow.com/questions/15745042/efficiently-convert-rows-to-columns-in-sql-server) – Duston Feb 22 '23 at 14:13

1 Answers1

1

This is like the most basic pivot example there can be. Admittedly, pivot syntax is kinda weird. From the top of my head:

select id, [Text01], [Text02], [Text03]
from yourtable
pivot (max(value) for Name in ([Text01], [Text02], [Text03])) pv
siggemannen
  • 3,884
  • 2
  • 6
  • 24