Home > database >  Transform table in SQL
Transform table in SQL

Time:02-11

can you please help with the question:

How do I transform a table in this format:

enter image description here

to this:

enter image description here

Thanks in advance!

CodePudding user response:

You can do:

select person, 'Salary' as metric, salary as metric_value from t
union all
select person, 'Spend', spend from t
  • Related