PHPMYadmin table 迁移

PHPMYadmin table Migraton

我需要一些有关 phpmyadmin 迁移的帮助

我有 2 个结构不同的表,我希望它自动将 NAME ADRESS LONGITUDE AND LATIDUDE 从 [store] 数据库复制到右行的 [tbl_storefinder_stores],但不知道怎么做。

也许你可以试试这个:

UPDATE table SET columnB = columnA

你可以在这里查看答案

Copy data into another table

    UPDATE tbl_storefinder_stores
SET lat = (
    SELECT latitude
    FROM store
    WHERE <condition here> 
    LIMIT 1
)

条件必须引用 tbl_storefinder_stores 字段之一

编辑:您想要的查询 运行 似乎是从 'store' table 中获取所有记录并将它们插入 tbl_storefinder_stores 中,并使用相同的值这个:

INSERT INTO tbl_storefinder_stores(store_name, store_address, lat, long)
            SELECT name, address, latitude, longitude
    from stores;

fiddle

如果您想在商店 table 中为其他 table 中的所有记录创建新记录,您可以这样做:

INSERT INTO stores(name, address, latitude, longtitude)
VALUES(
SELECT store_name, store_address, lat, long
from tbl_storefinder_stores
);

或者如果您想更新商店中的记录:

UPDATE stores
SET (name, address, latitude, longtitude)
= (select store_name, store_address, lat, long
   from tbl_storefinder_stores
   where tbl_storefinder_stores.field = stores.field) //field that is the same in both tables and won't change