如何用table a中的整行记录去更新table b中具有相同id的记录(a与b的表结构完全相同)?

flexfish 2002-04-24 12:05:47
不用set a.field1=b.field1,a.field2=b.field2.....这种方法。
...全文
85 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
teng 2002-05-05
  • 打赏
  • 举报
回复
hh
FangQ_78 2002-04-24
  • 打赏
  • 举报
回复
若A,B表结果如下:
Id number
B char
C char

则:
update a set (b,c)=(select b,c from b where a.id=b.id);
flexfish 2002-04-24
  • 打赏
  • 举报
回复
不是的我表结构写的不明确应该是:
table a 结构:
id number
s1 number
s11 number
s111 varchar2(10)

table b 结构:
id number
s2 number
s22 number
s222 varchar2(10)
如何做呢,不要用set s1=(select s2 from b where a.id=b.id),s11=(select s22 from b where a.id=b.id).....这种形式。
flowerofwind 2002-04-24
  • 打赏
  • 举报
回复
你是这个意思么?
update a set s1=(select s2 from b where a.id=b.id)
flexfish 2002-04-24
  • 打赏
  • 举报
回复
table a 结构:
id number
s1 number

table b 结构:
id number
s2 number
jornk 2002-04-24
  • 打赏
  • 举报
回复
delete from a where id=....
insert into a select * from b where id=...

2,596

社区成员

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

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