I Have a table like fallowing
work_id group effort
----------- ----- --------
1 A 10
1 B 5
2 A 7
2 C 20
2 B 3
I need a case when query that returns like fallowing
work_id 1.group effort1 2.Group effort2 3.group effort3
----------- ----- -------- ------- ------ ------- ------
1 A 10 B 5
2 A 7 C 20 B 3
goups are grouped based on another parameter that in another table. But when i write my query like
case when <condition1> then group end as 1.group
case when <condition2> then group end as 2.group
case when <condition4> then group end as 3.group
...(Same for efforts as well)
it returns
work_id 1.group effort 2.Group effort 3.group effort
----------- ----- -------- ------- ------ ------- ------
1 A 10 null null null null
1 null null B 5
2 A 7 null null null null
2 null null C 20
2 null null null null B 3
Can anyone help?