Import data using query and group it by row values : Good day,

I have a table with data which is structured like this:
[table1][1]


Is it possible to transform my table to table like this using query?
[table2][2]


  [1]: https://i.stack.imgur.com/bOZOe.png
  [2]: https://i.stack.imgur.com/pWUtD.png