How do Join and Get back results in sql sever

Based on the following tables(Table1 and Table2) structure. I would like to get a Table3. How can I do this in Sql Server ?


ID Name
1   A
2   B
3   C


ID Name
1  D
2  E

Expected Output is

ID Name
1   D
2   E
3   C


You could use COALESCE with an outer join

       COALESCE(t2.Name, t1.Name)AS Name 
FROM   table1 t1 
       LEFT OUTER JOIN table2 t2 
               ON t1.ID = t2.ID

Demo (with insert into Table3)

Need Your Help

why does my Java session values refuses to update?

java ajax jsp session servlets

I have a strange problem here and I dont know if any one has an idea what could cause it. I'm working on a Java EE (Servlets & JSPs) web application project that uses AJAX to update the web page.

AndEngine particle system

java android andengine

I would like to use AndEngine's particle system to create a splash(as in splashing water).