数据库简单的问题。

s_x_d 2002-09-24 08:45:23
table1 table2
ID NAME ID NAME WORK
1 a 1 teacher
2 b 2 student
3 c 3 student
4 d 4 teacher
...
其中ID唯一如何UPDATE使table2为
ID NAME WORK
1 a teacher
2 b student
3 c student
4 d teacher
...
...全文
31 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
wjlsmail 2002-09-24
  • 打赏
  • 举报
回复
update table2 set name=(select name from table1) and work=(select work from table1)

可以吗?(我没有试过)
s_x_d 2002-09-24
  • 打赏
  • 举报
回复
data==> paradox
上面的高手说的都不对!
s_x_d 2002-09-24
  • 打赏
  • 举报
回复
push!
s_x_d 2002-09-24
  • 打赏
  • 举报
回复
up+1
qxj 2002-09-24
  • 打赏
  • 举报
回复
update table2 set table2.name=table1.name
from table1,table2
where table1.id=table2.id
noall 2002-09-24
  • 打赏
  • 举报
回复
我在access里这样写:
update table2 inner join table1 on table2.id=table1.id set name=table1.name


duoduo79 2002-09-24
  • 打赏
  • 举报
回复
关注!
lazywolf 2002-09-24
  • 打赏
  • 举报
回复
update table2 set name=(select name from table1 where id=table2.id)
snake_eye 2002-09-24
  • 打赏
  • 举报
回复
同意楼上!
Drate 2002-09-24
  • 打赏
  • 举报
回复
update table2 set name=(select name from table1) where table2.id=table1.id

2,497

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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