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:
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.
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