Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

make 3 rows, 1 column from 1 row 3 colums

I have following table in db2:

id person 1 person 2 person 3
1 10 12 15

I now want to make a query that returns the following:

id person
1 10
1 12
1 15

how can I do this in db2?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks in advance!

>Solution :

Use a UNION:

select id, person1 as person
from the_table
union all 
select id, person2
from the_table
union all 
select id, person3
from the_table
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading