combine multiple rows in single row
-
Hi, I want to combine multiple rows in a single one. Have a look at the following sample. Any body know how to do this....thnx in advance original table ------------------ FID Code Value1 Value2 1 C1 20 Null 1 C1 Null 10 2 C1 30 Null 2 C1 Null 40 To -- FID Code Value1 Value2 1 C1 20 10 2 C1 30 40
-
Hi, I want to combine multiple rows in a single one. Have a look at the following sample. Any body know how to do this....thnx in advance original table ------------------ FID Code Value1 Value2 1 C1 20 Null 1 C1 Null 10 2 C1 30 Null 2 C1 Null 40 To -- FID Code Value1 Value2 1 C1 20 10 2 C1 30 40
SELECT FID,Code,Max(Value1),Max(Value2)
FROM TableName
Group By FID,Code -
Hi, I want to combine multiple rows in a single one. Have a look at the following sample. Any body know how to do this....thnx in advance original table ------------------ FID Code Value1 Value2 1 C1 20 Null 1 C1 Null 10 2 C1 30 Null 2 C1 Null 40 To -- FID Code Value1 Value2 1 C1 20 10 2 C1 30 40
-
SELECT FID,Code,Max(Value1),Max(Value2)
FROM TableName
Group By FID,CodePerhaps you should use
MIN
in any of fields forValue1
orValue2
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com
-
Perhaps you should use
MIN
in any of fields forValue1
orValue2
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com
why MIN?