How to copy the values of all id
from the post
table into the news_id
field of the news_id
table that is larger than the maximum news_id
table. Those. copy without duplicates.
So it just goes copying:
insert into `post_ex` (`news_id`) select `post`.`id` from `post`
How to enter a condition to copy only those values that are not yet?
post_ex
(news_id
) selectpost
.id
frompost
where not exists (select 1 from post_ex where news_id = post.id) - Proff