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 ;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b31122-3412f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b31122-3412f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?