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?

New contributor
Avichai Ben David is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
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

Avichai Ben David is a new contributor. Be nice, and check out our Code of Conduct.

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.