Basically, what I want to do is the following : I have a table 'users' in my first database (prc), like this :
基本上,我想要做的是:我在我的第一个数据库(prc)中有一个表'users',如下所示:
prc.user :
id_user : 45 | name_user : Test | login_user : test | pwd_user : test
[...]
And in my second database (named : prc_test)
在我的第二个数据库中(名为:prc_test)
prc_test.user
id_user : 45 | name_user : Test | login_user : test | pwd_user : test
[...]
The thing I want to do, is update all the "pwd_user" fields in "prc_test.user" with the values from pwd_user from "prc.user" But in the prc_test.user, the id are not the same as in prc.user, so I thought of doing it with the "name_user", (there are no doubles).
我想要做的是用“prc.user”中的pwd_user更新“prc_test.user”中的所有“pwd_user”字段但是在prc_test.user中,id与prc.user中的id不同,所以我想用“name_user”来做这件事,(没有双打)。
Any clue in how I can do it ? I searched on Google, but what I found is always for some specific cases, or for insert statements...
我怎么能这样做的任何线索?我在Google上搜索过,但我发现的总是针对某些特定情况或者插入语句......
(I'm using MySQL5.5)
(我使用的是MySQL5.5)
Thanks !
谢谢 !
1 个解决方案
#1
53
UPDATE
prc.user,
prc_test.user
SET
prc_test.user.pwd_user = prc.user.pwd_user
WHERE
prc_test.user.name_user = prc.user.name_user
#1
53
UPDATE
prc.user,
prc_test.user
SET
prc_test.user.pwd_user = prc.user.pwd_user
WHERE
prc_test.user.name_user = prc.user.name_user