I want to merge rows in SQL server as follows.
Table
PK F1 F2 F3 Order
A NULL NULL Grapes 2
B NULL Fig NULL 1
C Apple Orange Banana 0
The input and the expected result is as follows.
Input Expected Result
2 Apple Fig Grapes
1 Apple Fig Banana
0 Apple Orange Banana
How can I do this in sql stored procedure? I prefer to do in Sql other than in code.
Thanks in Advance
If I understand you input right then maybe something like this:
Test data
Query
Result