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 union two incomplete tables in teradata

I need to union two incomplete tables in Teradata. I know there is a function analogous to union in Teradata that does this.

first table:

id name
1  John
2  NULL
3  Nick
4  NULL

second table:

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

id name
1  John
2  Andrew
3  NULL
4  NULL

I need union them to get:

id name
1  John
2  Andrew
3  Nick
4  NULL

How to do it?

I know this can be done through a normal union\join. But I dont know how.

>Solution :

To me, it looks like a join along with the coalesce function:

select a.id,
       coalesce(a.name, b.name) name
from t1 a join t2 b on a.id = b.id
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