Given table:
ID NAME VALUE
1 A N
1 B Y
1 C N
I want the table in below format:
ID A B C
1 N Y N
Given table:
ID NAME VALUE
1 A N
1 B Y
1 C N
I want the table in below format:
ID A B C
1 N Y N
You can use conditional aggregation
select id,
max(case when name='A' then value end) as A,
max(case when name='B' then value end) as B,
max(case when name='C' then value end) as C
from tablename
group by id