Skip to content
Advertisement

Transpose each row in SQL SELECT

The following SQL

this returns some like this:

Instead I need

i.e. each row transposed. exactly in that order.

What is the best way to implement this using just SQL?

Advertisement

Answer

The simplest method is union all:

However, it is more efficient typically to use a CROSS JOIN:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement