0

I'm using SQL server but am new to the idea of pivoting. I've seen examples online but am struggling with how to transfer existing columns into the new table.

My original table is as follows;

enter image description here

and I would like this to be transposed to the following format, taking averages of the values where available;

enter image description here

can anybody please advise how I can do this?

Thanks

Community
  • 1
  • 1
Ash_23S
  • 115
  • 1
  • 11
  • [This is what you want](https://stackoverflow.com/questions/10404348/sql-server-dynamic-pivot-query) and you just need to append the *avg_value* to the column name – S3S Jan 25 '19 at 15:02
  • "Provide a clear textual explanation of the problem at hand. Provide proper sample data, as DDL (Create table statement(s)) and DML (Insert statement(s)). The sample data should be enough to demonstrate the problem, including edge cases. Usually, a few relevant rows are enough." src : https://stackoverflow.com/tags/sql-server/info – Daniel E. Jan 25 '19 at 15:31

0 Answers0