I need to make layout from my SQL data. So, I need SQL data one column to multiple column but column or row quantity will be variable. Any ideas please.
Example (SQL column):
Serial
1
2
3
4
5
6
Need look like (if customer I want 2 column than):
1 6 or 1 4
2 5 2 5
3 4 3 6
This query generates pairs of rows from the Serial column in a layout that matches
(1 6, 2 5, 3 4)by utilizing row numbers and joining the table with itself based on the row numbers assumeing theSerialcolumn contains sequential numbers starting from1.See this db<>fiddle.