V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
shimingzhoudf
V2EX  ›  MySQL

mysql 备份同步

  •  
  •   shimingzhoudf · Sep 4, 2020 · 2278 views
    This topic created in 2074 days ago, the information mentioned may be changed or developed.

    A 表有 1,2,3,4,5 个字段。现在同步了 1,2 字段到 B 表,数据也同步过去了 现在需求是,我需要把 3 字段和数据弄到 B 表中,每行按原来 A 表对应

    2 replies    2020-09-04 22:40:28 +08:00
    kefirzhang
        1
    kefirzhang  
       Sep 4, 2020
    你这个标题起的好像跟内容不是很对,不知道你到底想干什么,我最后的猜想你可能是要更新 B 表的数据:
    直接 update 就可以了。就像下面的 sql 句子一样( ab 互换)
    Update a
    Set a.importantField = b.importantField
    From a Join b
    On a.matchfield = b.matchfield
    And a.matchfield2 = b.matchfield2
    twinsdestiny
        2
    twinsdestiny  
       Sep 4, 2020
    B 表建 3 字段,根据 1,2 字段从 A 表更新就好了,还是说 1,2 字段无法确定唯一
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2958 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 07:25 · PVG 15:25 · LAX 00:25 · JFK 03:25
    ♥ Do have faith in what you're doing.