Reputation: 1691
I have data generated like this
RowNumber Firmware value1 value2
1 1 5 NULL
1 1 NULL NULL
1 1 NULL NULL
Any idea how to group this to get a single row using TSQL?
The output should be
RowNumber Firmware value1 value2
1 1 5 NULL
The rows with NULL values for 'value1' and 'value2' should be eliminated.
Upvotes: 0
Views: 78
Reputation:
Select
RowNumber,
FirmWare,
MAX(Value1) as Value1,
MAX(Value2) as Value2
from Table
Group by
RowNumber, FirmWare
Upvotes: 0
Reputation: 6021
why not
...
where
not value1 is null
or not value2 is null
In this way you eliminate the rows with NULL values for value1 and value2 and obtain only one row without using group by.
Upvotes: 1