Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Converting column in row.

syed haiderMay 11 2018 — edited May 11 2018

I'm quering employees who participated in activity1 and activity2. I'm getting output as following. I would like to convert these two rows into one.

employee_number          activity1       activity2

1                                        yes               no

1                                        no                 yes

The same employee did activity1 and activity 2. However, it's showing in two separate rows. It's because I have a case statement as follows

select employee_number,

case when activity1 = 1 then 'Yes' else 'No' end activity1,

case when activity2 = 2 then 'Yes' else 'No' end activity2

from report_data

I need to see the output as below

employee_number          activity1       activity2

       1                    yes               yes

Please let me know as how can I get the above output.

Thanks in advance!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 8 2018
Added on May 11 2018
6 comments
274 views