insert...select问题

Eric1006 2003-10-30 11:49:47
table A
有字段:pkid, int, pk
age,int, not null
name,varchar(20), not null
table B
有字段:pkid,int,pk
name,varchar(20),not null
time,datetime,not null

问题:
i=20 to 30
将数值i插入table A的age
同时将所有table b中满足time-1983=i的所有记录插入table a

能否用insert……select语句来完成
...全文
29 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
shuiniu 2003-10-30
  • 打赏
  • 举报
回复
?????

insert tablea
select pkid,(datepart(yyyy,time) - 1983),name
from tablebb
where (datepart(yyyy,time) - 1983) between 20 and 30

34,874

社区成员

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

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