Reputation: 430
I have query like this :
select
case when code=31 then name end as name1,
case when code=32 then name end as name2
from master where code=31 or partner_id=32
and the result just like this :
I want to make just 1 row but 2 column which is the value is like the table above.
Anyone can help me? Thanks
Upvotes: 0
Views: 82
Reputation: 1269443
Use aggregation:
select max(case when code=31 then name end) as name1,
max(case when code=32 then name end) as name2
from master
where code = 31 or partner_id = 32;
Upvotes: 1