I have a data result from a view like below,
But I want a view like this
Can any one help me to do this via postgresql without using extensions.
I have a data result from a view like below,
But I want a view like this
Can any one help me to do this via postgresql without using extensions.
use aggregation
select project, max(case when role='owner' then name end) as owner,
max(case when role='client' then name end) as client,
max(case when role='Team' then name end) as Team
from table
group by project;
Alternatively you can use the filter()
clause which makes this a bit easier to read:
select project,
max(name) filter (where role='owner') as owner,
max(name) filter (where role='client') as client,
max(name) filter (where role='Team') as Team
from table
group by project;