将数据从tb1移动到tbl2,其中

时间:2018-08-13 13:29:33

标签: sql sql-server

我需要将数据从reg的{​​{1}}列移到table1的{​​{1}},其中{{的reg2的{​​{1}} 1}}。

基本上,只要此人在 B 中,我就需要将汽车注册从 A 更改为 B

2 个答案:

答案 0 :(得分:1)

使用联接更新表列

update t2
set t2.reg2=t1.reg
from table2 t2 inner join table1 t1
on t2.ID2=t1.ID

答案 1 :(得分:0)

{
    "activeMQServer" : {
        "bridge" : {
            "maxRetryIntervalMin" : 3,
            "retryIntervalMs" : 5000,
            "retryIntervalMultiplier" : 1.5
        }
    },
    "baseDirectory" : "[PATH]",
    "dataSourceProperties" : {
        "dataSource.password" : "",
        "dataSource.url" : "jdbc:h2:file:[PATH]/Notary/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=100;AUTO_SERVER_PORT=0",
        "dataSource.user" : "sa",
        "dataSourceClassName" : "org.h2.jdbcx.JdbcDataSource"
    },
    "database" : {
        "exportHibernateJMXStatistics" : "false",
        "transactionIsolationLevel" : "REPEATABLE_READ"
    },
    "devMode" : true,
    "emailAddress" : "admin@company.com",
    "exportJMXto" : "http",
    "h2port" : 0,
    "keyStorePassword" : "trustpass",
    "myLegalName" : "O=Notary, L=Uruguay, C=UY",
    "notary" : {
        "custom" : false,
        "validating" : true
    },
    "p2pAddress" : "[IP]:10003",
    "rpcSettings" : {
        "address" : "localhost:10004",    
        "adminAddress" : "localhost:10005",
        "standAloneBroker" : false,
        "useSsl" : false
    },
    "rpcUsers" : [
        {
            "password" : "default",   
            "permissions" : [
                "ALL"
            ],
            "username" : "default"
        }
    ],
    "trustStorePassword" : "trustpass",
    "useTestClock" : false,
    "verifierType" : "InMemory",
    "webAddress" : "localhost:10006"
}