I have a table with 5 columns with values 0 or 1 and the last column QuoteStatus
is of type VARCHAR
.
I want to keep ControlNo
and the other 4 columns as is, but the last column I need to pivot and also assign value either 0 or 1.
It can be more than 2 values: Lost
or No Action
.
So the data looks like this now:
DECLARE @Table1 TABLE
(
ControlNo INT,
Bound INT,
Declined INT,
Rated INT,
Quoted INT,
QuoteStatus VARCHAR(50)
)
INSERT INTO @Table1 (ControlNo, Bound, Declined, Rated, Quoted, QuoteStatus)
VALUES
(1111,1,0,1,1,'Lost'),
(2222,0,1,0,1,'No Action'),
(3333,1,1,0,0,NULL),
(4444,1,0,0,1,'Lost'),
(5555,0,1,1,1,'No Action')
But I want it to look like this: