Hi all,
I have the following table which I need to convert
DECLARE @Class TABLE
(
ID int,
Line1 int,
Line1Percentage int,
Line2 int,
Line2Percentage int,
Line3 int,
Line3Percentage int
)
INSERT INTO @Class
VALUES (1, 2, 100, NULL, NULL, NULL, NULL)
, (2, 22, 100, NULL, NULL, NULL, NULL)
, (3, 5, 50, 7, 50, NULL, NULL)
, (4, 25, 50, 7, 40, 2, 10)
SELECT * FROM @Class
ID Line1 Line1Percentage Line2 Line2Percentage Line3 Line3Percentage
1 2 100 NULL NULL NULL NULL
2 22 100 NULL NULL
NULL NULL
3 5 50 7 50 NULL NULL
4 25 50 7 40
2 10
I need it to return the following: Line column will have the combination of Line1, Line2 and Line3
Perentage will have the Line1Percentage, Line2Percentage, Line3Percentage. I would like my table not to return any nulls.
ID Line Percentage
1 2 100
2 22 100
3 5 50
3 7 50
4 25 50
4 7 40
4 2 10
Is this possible?