Suppose,I have a table with 3 columns and 9 rows and I am using SQL Server 2008.
I want to write a SQL query to get first three rows of data from the original table in one
row then from 4th row to 6th row get the data and put in the second row and so forth.
The table name is “Table1”
Primary_Key | Name | Age
++++++++++++++++++++++++++++
A | Kyle | 45
B | Rob | 66
C | Dhruba | 77
D | Susan | 99
E | Steve | 100
F | Mili | 34
G | Grover | 54
H | Alan | 76
I | Paul | 16
I am looking for this result after I run the query:(3 rows , 1 column)
ColumnA
+++++++++++++++
A, Kyle, 45, B, Rob,66, C,Dhruba,77
D,Susan,99, E,Steve , 100,F, Mili, 34
G , Grover , 54,H , Alan , 76,I , Paul , 16
Thanks in Advance!
1 Answer