如何根据B表中的数据来更新A表?在线等待!来者有分!

geleisi 2005-07-07 11:43:17
现数据库中有两个表A、B,
A 表结构:
| uid | username | password |
| 1 | a | |
| 2 | c | |
| 3 | f | |
B 表结构:
| uid | username | password |
| 1 | a | aa |
| 2 | b | bb |
| 3 | c | cc |
| 4 | d | dd |
| 5 | e | ee |
| 6 | f | ff |

请问如何得到这样的结果?

| uid | username | password |
| 1 | a | aa |
| 2 | c | cc |
| 3 | f | ff |
...全文
58 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
mathematician 2005-07-07
  • 打赏
  • 举报
回复
update A,B set A.password=B.password where A.username=B.username;
geleisi 2005-07-07
  • 打赏
  • 举报
回复
谢谢mathematician(数学家)!

56,687

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧