將mysql中的一張表中的一個字段數據根據條件導入另外一張表中

添加字段:alter table matInformation add facid varchar(99)  default '';spa

導入數據:update matInformation m set facid=(select facid from material_register v where m.partNumber=v.partNumber);(參考:https://blog.csdn.net/mar_fuck/article/details/79460571).net

遇到問題:ERROR 1366 (HY000): Incorrect string value: '\xCE\xA9,1%,...' for column 'facid' at row 2(參考:https://blog.csdn.net/xiatiancc/article/details/88013915)orm

  解決:show create table material_register;blog

    show create table matInformation;ci

    兩張表的字符集不一致,須要修改要導入數據的那一張表.get

    alter table matInformation convert to character set utf8mb4 collate utf8mb4_bin;string

相關文章
相關標籤/搜索