社区
MS-SQL Server
帖子详情
求用一个表更新另一个表的SQL语句
chengchangwei
2004-10-13 02:43:19
table1 table2
id1 status id1 status
1 y 1 A
2 z 2 b
现在当table2.id1=table1.id1时,要用Table2的status的值代替table1中的status的值.
即更新后得到:
table1
id1 status
1 A
2 b
...全文
613
8
打赏
收藏
求用一个表更新另一个表的SQL语句
table1 table2 id1 status id1 status 1 y 1 A 2 z 2 b 现在当table2.id1=table1.id1时,要用Table2的status的值代替table1中的status的值. 即更新后得到: table1 id1 status 1 A 2 b
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
8 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
hqcsx
2004-10-13
打赏
举报
回复
你可以试一下:
update table1 set table1.status=table2.status where table1.id=table2.id
lsxaa
2004-10-13
打赏
举报
回复
update table1 set status=table2.status
from table2
where table1.id1=table2.id1
heibai520
2004-10-13
打赏
举报
回复
update a set a.status=b.status
from table1 a,table2 b
where a.id1=b.id1
shuijun
2004-10-13
打赏
举报
回复
update table1 set a.status = b.status
from table1 a inner join table2 b
on a.idl = b.idl
hsh_boy
2004-10-13
打赏
举报
回复
upadte table1 set table1.status =table2.status
from table1,table2
where table1.idl=table2.idl
freddy2003
2004-10-13
打赏
举报
回复
up
zjcxc
元老
2004-10-13
打赏
举报
回复
update a set a.status=b.status
from table1 a,table2 b
where a.id1=b.id1
WangZWang
2004-10-13
打赏
举报
回复
update a set a.status=b.status
from table1 as a
inner join table2 as b
on a.id1=b.id1
SQL学习资料(包含所有常用的语句例子)
sql学习必备,内含sql一些常用语句的例子,有图有
表
,通过结果来理解
sql语句
的实现与结果。
mySQL:两
表
更新
(用
一个
表
更新
另
一个
表
)的
SQL语句
概述:用
一个
表
中的字段去
更新
另外
一个
表
中的字段, MySQL 中有相应的 update 语句来支持,不过这个 update 语法有些特殊。看
一个
例子就明白了。 方法一: update people s set city_name = (select name from ...
SQL语句
用
一个
表
的数据
更新
另
一个
表
在Sqlserver的维护
更新
操作中,有时候涉及到Update操作,其中有一种情况是根据特定的条件,以
一个
表
中的数据
更新
另
一个
表
的数据,此时涉及到两个
表
之间的关系以及操作,此处介绍2种
更新
方法。 (1)方法一格式:...
mysql从
一个
表
更新
数据到另
一个
表
中_一条
sql语句
实现从
一个
表
中获取数据
更新
到另
一个
表
中...
如果我们想要从一张
表
中取数据,并将这些数据
更新
保存到另一张
表
...那么有没有什么语法,可以一条
sql语句
实现从
一个
表
中获取数据
更新
到另
一个
表
中呢?像Insert那样,把整个Select语句的结果进行插入呢?INSERT INTO...
SQL 两
表
关联
更新
UPDATE (用
一个
表
更新
另
一个
表
)
SQL两
表
关联
更新
UPDATE(用
一个
表
更新
另
一个
表
)
MS-SQL Server
34,590
社区成员
254,589
社区内容
发帖
与我相关
我的任务
MS-SQL Server
MS-SQL Server相关内容讨论专区
复制链接
扫一扫
分享
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章