I have a demo table as
EMPLOYEEID INDIPAY OTHERPAY ISACTIVE
1 200 300 true
1 100 150 false
I want the output as follows
EMPLOYEEID INDPAY_ISACTIVE INDPAY_ISNOTACTIVE OTHERPAY_ISACTIVE OTHERPAY_ISNOTACTIVE
1 200 100 300 150
The Query
select employeeid,
max(case when IsActive = 'true' then IndiPay end) IndPay_IsActive,
max(case when IsActive = 'false' then IndiPay end) IndPay_IsNotActive,
max(case when IsActive = 'true' then otherPay end) OtherPay_IsActive,
max(case when IsActive = 'false' then otherPay end) OtherPay_IsNotActive
from pay_table
group by employeeid
output on tool
