sql出错

Andy_2010_ 2009-11-04 11:26:06

/*
table1
LH LB
table2
LH LB
现在我想更新tabl2 LB 条件是table1的LH =table2的LH
*/
update table2 set LB = LH.LB
from table1 LH inner join table2.LH on LH.LH = LH.LH
...全文
81 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
tomyfolder 2009-11-04
  • 打赏
  • 举报
回复
字段名改改!看行不?
Andy_2010_ 2009-11-04
  • 打赏
  • 举报
回复

是同样的字段名
取个别名就行、
-狙击手- 2009-11-04
  • 打赏
  • 举报
回复
update LH2 set LB = LH1.LB
from table1 LH1 inner join table2 LH2 on LH1.LH = LH2.LH
忆轩辕 2009-11-04
  • 打赏
  • 举报
回复
update table2 set LB = table1.LB
from table1 inner join table2 on table1.LH = table2.LH
--小F-- 2009-11-04
  • 打赏
  • 举报
回复
update table2 set LB = LH.LB 
from table1 LH1 inner join table2 LH2 on LH1.LH = LH2.LH
jiangshun 2009-11-04
  • 打赏
  • 举报
回复
update table2 set LB = A.LB 
from table1 A inner join table2 B on A.LH = B.LH
--小F-- 2009-11-04
  • 打赏
  • 举报
回复
update table2 set LB = LH.LB 
from table1 LH inner join table2 LH on LH.LH = LH.LH
xuam 2009-11-04
  • 打赏
  • 举报
回复
update table2 set LB = a.LB
from table1 a inner join table2 b on a.LH = b.LH

34,870

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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