Skip to Main Content

Merging consecutive rows of a table

600625Sep 30 2007 — edited Nov 4 2010
I want to merge consecutive rows of a table. i.e. if my table has 4 rows of data then my ouput of query will have only 3 rows because
rows 1 and 2 are merged to first row of result
rows 2 and 3 are merged to second row of result
rows 3 and 4 are merged to third row of result

For example if my table is
____
A | B
-------
1 | 4
9 | 7
3 | 2
7 | 9

then output of query should be
____________
A | B |A1| B1
---------------------
1 | 4 | 9 | 7
9 | 7 | 3 | 2
3 | 2 | 7 | 9

How can i write a query to achieve this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Oct 29 2007
Added on Sep 30 2007
17 comments
7,093 views