create table tablea ( tid int , mid int ) go create table tableb ( fid int, tid int ) go begin declare @coun int set @coun=1 while @coun<20 begin insert into tablea values(20,@coun) insert into tableb values(@coun,@coun) set @coun=@coun+1 end end go update tablea set tablea.tid=tableb.fid from tableb where tablea.mid=tableb.tid go
SQL 数据库的跨表修改操作
最新推荐文章于 2022-06-07 00:18:07 发布
本文演示了如何使用SQL语句创建两个表格,并通过循环批量插入数据到这两个表格中。接着展示了如何根据两个表之间的关联进行数据更新操作。这对于理解SQL的基础语法及表间数据操作非常有帮助。
1867

被折叠的 条评论
为什么被折叠?



