I want to create the following output from below image:
The input data is from a view (Select * from test). The goal is to get all data where the progress column contains the text tbd and the counter number is 1.
Can this be solved with case when statement?
Since sqlfiddle is not working here's the schema:
CREATE TABLE test
(
[ID] [int] NOT NULL,
[Counter] [int] NOT NULL,
[Name] nvarchar(200) NULL,
[Progress] nvarchar(200) NOT NULL
)
INSERT INTO test
VALUES (1, 1, 'userA', 'tbd'),
(1, 2, 'userB', 'done'),
(1, 3, 'userC', 'tbd'),
(2, 1, 'userB', 'done'),
(2, 5, 'userA', 'tbd'),
(3, 1, 'userD', 'tbd'),
(3, 2, 'userA', 'done'),
(3, 7, 'userC', 'tbd'),
(3, 11, 'userB', 'tbd')
I couldn't get it to work.
Hope you can help me out.
Thanks alot.
