I have a table called requesttool.request_detail which is used to store attributes for entities identified by the value in column REQUEST_ID. The table requesttool.request_detail has a column called ATTRIBUTE_ID which indicates what is stored in the respective row of another column called ATTRIBUTE_VALUE. For instance, if ATTRIBUTE_ID='259' for a given row then name will be stored in that respective row of ATTRIBUTE_VALUE.
Here is what requesttool.request_detail looks like in practice:
What I want to do is to extract the value stored in ATTRIBUTE_VALUE for 3 different ATTRIBUTE_ID's and for a given REQUEST_ID, say 4500161635, and display them in a single row, like this:
I have tried the following code:
select
request_id,
case when attribute_id = '289' then attribute_value end as name,
case when attribute_id = '259' then attribute_value end as country,
case when attribute_id = '351' then attribute_value end as priority
from (
select a.request_id, a.attribute_id, a.attribute_value
from requesttool.request_detail a
where a.request_id='4500161635');
but from this I obtain a table with null values, not a single line:


