0

I want to merge 2 rows of data into 1 row. I've tried searching on how to do that all i saw was no good.

Here is my sample table

ID | Col1    | Col 2
=====================
1  | value11 | value12
2  | value12 | value22

This is what i want to achieve

ID | Col1    | Col 2   | Col21   | Col22
==========================================
1  | value11 | value12 | value12 | value22

Please help... Thanks in advance.

KrLontoc
  • 117
  • 9

1 Answers1

0

One of the 100 samples

SELECT
 s1.id,
 s1.col1 AS c1,
 s1.col2 AS c2,
 s2.col1 AS c21,
 s2.col2 AS c22 
FROM sample_table AS s1 
LEFT JOIN sample_table AS s2 ON s1.id +1 = s2.id
WHERE s1.id = 1;
Bernd Buffen
  • 14,525
  • 2
  • 24
  • 39