• Database

    UNPIVOT in SQL

    Below example converts rows to columns using UNPIVOT clause. Assuming you have a table like this: And you want to convert like this: Use the query: You can also apply WHERE clause like this: Result: