Reputation: 127
It only returns value of EIA and not EIA 2
(
case
when tc.name = 'EIA' then tor.value else null
end
) as EIA,
(
case
when tc.name = 'EIA 2' then tor.value else null
end
) as EIA2
This is this Table Structure
Test Performed Tor Values EIA, EIA 2 Positive, Positive
ID Name EIA EIA 2
1 John POSITIVE no values??
Upvotes: 1
Views: 46
Reputation: 4491
Try this:
(
CASE
WHEN tc.name IS NULL THEN '' WHEN tc.name = 'EIA' THEN tor.value
END
) as EIA,
(
CASE
WHEN tc.name IS NULL THEN '' WHEN tc.name = 'EIA 2' THEN tor.value
END
) as EIA2
Upvotes: 1
Reputation: 18600
(CASE
WHEN tc.name = 'EIA' THEN tor.value
WHEN tc.name = 'EIA 2' THEN tor.value
ELSE NULL
END)
OR
(CASE
WHEN tc.name = 'EIA' THEN tor.value
END) as EIA,
(CASE WHEN tc.name = 'EIA 2' THEN tor.value
END) as EIA2
Upvotes: 0