Skip to content
Advertisement

Five Columns to a single row

I have the following data

I am required to return the result as follows – fit five rows in one column:

There is nothing to group on or segregate these into rows. So I assigned a row_number and did mod 5 on the row_number. It almost works, but not quite.

Here is what I have tried:

the result is :

Can someone please show me how to get to my desired result?

Advertisement

Answer

How about

OR

You can use (SELECT 1) instead of LEN(Orders)

Returns:

Demo

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