求一个sql语句

hexinyu2005 2007-05-14 03:41:39
有两个表t1,t2,结构都是一样的,均有4个字段
id,a,b,c

现在用b表的id为10的数据去更新a表的id为10的数据
请问怎么写
...全文
245 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
sdlpy 2007-05-14
  • 打赏
  • 举报
回复
前提是:两个表的ID必须一致
sdlpy 2007-05-14
  • 打赏
  • 举报
回复
支持楼上的,可以实现,我试了
frankxiong1983 2007-05-14
  • 打赏
  • 举报
回复
update t1 set a=t2.a,b=t2.b,c=t2.c from t2 where t1.id=t2.id and t1.id=10
cflegs 2007-05-14
  • 打赏
  • 举报
回复
我那条语句text类型也可以的
hexinyu2005 2007-05-14
  • 打赏
  • 举报
回复
怎么都不看清楚才回答呢???

a,b,c3个字段都是text类型的
cflegs 2007-05-14
  • 打赏
  • 举报
回复
update t1 set a=t2.a,b=t2.b,c=t2.c from t1,t2 where t1.id=t2.id and t1.id=10
hexinyu2005 2007-05-14
  • 打赏
  • 举报
回复
在这一子查询或聚合表达式中,text、ntext 和 image 数据类型无效。
枫雅小憩 2007-05-14
  • 打赏
  • 举报
回复
update a set a.a = b.a,a.b=b.b,a.c=b.c FROM t1 a,t2 b where a.id=b.id
零伍贰陆 2007-05-14
  • 打赏
  • 举报
回复
update t1 set id = (select * from t2 where id = 10) where id = 10
hexinyu2005 2007-05-14
  • 打赏
  • 举报
回复
declare @strBody varchar(3000)
set @strBody=(select body from T_bak where id=1753)
update T set body=@strBody where id=1753

这是我自己写的,提示
在这一子查询或聚合表达式中,text、ntext 和 image 数据类型无效
hexinyu2005 2007-05-14
  • 打赏
  • 举报
回复
在这一子查询或聚合表达式中,text、ntext 和 image 数据类型无效

我自己写的

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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