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 can I merge this query so that it returns only one column?

I have the following table:

Player Name Nationality
Romelu Lukaku   Beligian
Christian Pulisic   American
Kai Havertz German
Masoun Mount    British
Reece James British
Edouard Mendy   French
N'Golo Kante    French
Hakim Ziyech    Morrocan
Timo Werner German
Thiago Silva    Brazilian
Ross Barkley    British

I typed the following query:

SELECT REPLACE([Player Name], 'Reece', 'John'),
 REPLACE([Player Name], 'Christian', 'Chris') FROM Players

The query above returns two columns rather than just one. How can I make the query one so that only one column gets returned?.

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 :

You can use UNION tojoin rows vertically

SELECT REPLACE([Player Name], 'Reece', 'John') as name FROM Players
UNION
SELECT REPLACE([Player Name], 'Christian', 'Chris') FROM Players
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