SQL语句问题 高手请进 急在线等

pc144818 2009-04-02 11:22:30
UPDATE (select * from 表1 inner join 表2 on 表2.studentNo=表1.studentNo
where 表2.studentNo='123456789') SET 表2.healthScore = 表1.score*0;

这句话在ACCESS中好使 但放到SQL SERVER2000中就不好使了!
请高手帮忙更改一下吧!!
就是说我想更改表2的healthScore 字段 但是是从表1的score的字段中提取的*0
条件是学号等于123456789

请高手指教下! 谢了!
...全文
60 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
dsp_zerg 2009-04-02
  • 打赏
  • 举报
回复

UPDATE 表2 SET 表2.healthScore = 表1.score*0
FROM 表2 JOIN 表1
ON 表2.studentNo=表1.studentNo
WHERE 表2.studentNo='123456789'
--方法二
UPDATE 表2 SET 表2.healthScore = 表1.score*0
FROM 表2 JOIN 表1
ON 表2.studentNo=表1.studentNo ='123456789'
--没测试哈
Dora 2009-04-02
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 qingyun0719 的回复:]

update 表2 set 表2.healthScore=表1.score*0
where 表2.studentNo=表1.studentNo and 表2.studentNo='123456789'
[/Quote]

update 表2,表1 set 表2.healthScore=表1.score*0
where 表2.studentNo=表1.studentNo and 表2.studentNo='123456789'

更正:
Dora 2009-04-02
  • 打赏
  • 举报
回复

update 表2 set 表2.healthScore=表1.score*0
where 表2.studentNo=表1.studentNo and 表2.studentNo='123456789'
claro 2009-04-02
  • 打赏
  • 举报
回复
--提醒,更新前做好备份。
claro 2009-04-02
  • 打赏
  • 举报
回复
UPDATE 表2 SET 表2.healthScore = 表1.score*0
from 表2 inner join 表1 on 表2.studentNo=表1.studentNo
where 表2.studentNo='123456789') ;
liangCK 2009-04-02
  • 打赏
  • 举报
回复
UPDATE 表2 SET
healthScore = 表1.score*0
FROM 表1
inner join 表2
on 表2.studentNo=表1.studentNo
where 表2.studentNo='123456789';

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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