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

How to concatenate two columns in oracle select query?

The following is the sample data of my table which I created it in Oracle 19c.

id first_numbers second_numbers
10 123 111
10 122 123
10 111 124
11 333 111
11 444 222
11 222 124

In above table some duplicate values are existed for each id, I want to remove the duplicate values for each id and I want the values of both columns to be shown in one column in the result query
The expected result which I want is:

id concatenated_colums
10 123
10 111
10 122
10 124
11 333
11 111
11 222
11 124

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

>Solution :

Use a UNION statement:

SELECT id, first_numbers "concatenated_colums" FROM table
UNION
SELECT id, second_numbers "concatenated_colums" FROM 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