Mysql从一个列插入唯一值到另一个表的列


mysql insert unique values from one column to a column of another table

请帮我解决这个问题:我需要复制entries_list中的唯一值。Nr_comanda_entries to entres_uploed .ship_id

表有这些共同的值: entres_list。File_id = entries_uploed .id

两个表都有许多其他列,只有entries上传。Ship_id 为空。

你能告诉我mysql查询做到这一点吗?

您可以使用UPDATE查询和INNER JOIN:

UPDATE
  entries_uploaded INNER JOIN entries_list
  ON entries_list.file_id = entries_uploaded.id
SET
  entries_uploaded.ship_id = entries_list.nr_comanda_entries