0

Hope you're doing well.

Let's say I have a table looking like this:

Date Column Val
date1 x 5
date1 y 20
date1 z 48
date2 x 10
date2 y 30

I wish to get the following table:

Date x y z
date1 5 20 48
date2 10 30 null

Is it possible?

3
  • The keyword you're looking for is "pivot". The solution will likely be different for each DBMS, so you should remove irrelevant tags from your question.
    – mustaccio
    Jun 23 at 11:27
  • BigQuery, MySQL or Postgres? Please do not tag databases not involved. Jun 23 at 11:29
  • 1
    PIVOT operator
    – Akina
    Jun 23 at 11:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.