Join a same table using key and values to get data in one row

This is my table structure,

i wabt to combine the same table with its key values like prop_key ='color'

id    journal_id     property     prop_key       old_value                        value
405   252             attr         color         1                                 0
372   252             attr       updated_at      2017-03-18 03:43:34 UTC     2017-03-18 03:43:34 UTC
402   252             attr       sprint_id       5                                 0

I want the result in this form.

id           color       sprint_id           start_date
372           2           5               2017-03-18 03:43:34 UTC  

I try the following

       max(case when a.prop_key='color' then a.value end) attr_val1,
       max(case when a.prop_key='sprint_id' then a.value end) attr_val2,
       max(case when a.prop_key='updated_at' then a.value end) attr_val3
from journal_details t
left join journal_details a on =
where t.journal_id=242 
group by

    a1.value as color,
    a2.value as sprint_id,
    a3.value as start_date
from journal_details
    left join (select * from journal_details where prop_key='color') a1 on
    left join (select * from journal_details where prop_key='sprint_id') a2 on
    left join (select * from journal_details where prop_key='start_date') a3 on
    where journal_details.journal_id=242

But i didnot get satisfactory result.


You don't need a self join.

Try this:

select min(id),
    max(case when prop_key = 'color' then value end) attr_val1,
    max(case when prop_key = 'sprint_id' then value end) attr_val2,
    max(case when prop_key = 'updated_at' then value end) attr_val3
from journal_details
where journal_id = 242


 ? 1045 - Access denied for user after executing query
 ? MaxRow Trigger not working in mysql
 ? MySQL INSERT syntax giving a weird error
 ? MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)
 ? SQL Error 1064, Syntax error received
 ? temporay table update mysql
 ? MIssing semicolon error in stored procedure mysql workbench
 ? My SQL set permissions
 ? how to cut the strings before a particular strings in sql
 ? MySQL temp table issue