0

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 :

query result

I want to make just 1 row but 2 column which is the value is like the table above.

Anyone can help me? Thanks

1 Answer 1

1

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;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.