How in a SQL query to substitute the values ​​of the column in the column name?

img

The Тип column contains types of delivery of items, they must be substituted into the names of the Тип column itself. Those. to look like this:

|fio|Курс|Семестр|Группа|Оценка|Предмет|eczamen|zachet|

And under them should be an appropriate assessment.

  • And under them should be an appropriate assessment. - TickGO

1 answer 1

Actually with your hands:

 select fio,Курс,Семестр,Группа,Предмет, max(case when Тип='eczamen' then Оценка else '' end) eczamen,| max(case when Тип='zachet' then Оценка else '' end) zachet from table Group by fio,Курс,Семестр,Группа,Предмет 
  • | is it a typo at the end of the second line? - Regent
  • That's right! Thank you so much!! - TickGO