How does Mysql merge two tables

clipboard.png

ask how to write the sql statement

Mar.02,2021

SELECT [Id],[link],ISNULL((SELECT [content] FROM [Table_B] WHERE Id=[Tabe_A].[link]),'')  AS [content] FROM [Table_A] 

get the final value

select a.id, if(a.content is null, b.content, a.content) as content from a left join b on a.link = b.id;

think of this as a temporary table and update a (here if, assumes that table a has a content field)

update a as c,
(
  select a.id, if(a.content is null, b.content, a.content) as content 
  from a 
  left join b on a.link = b.id
) as d 
set c.content = d.content 
where d.id=c.id ;
Menu