怎样将表中的某些记录插入到另外一个表?

clubsondy 2006-08-22 02:59:11
怎样将表中的某些记录插入到另外一个表?两个表中的字段是一样的。
另一个表中本来也是有记录的,不要被覆盖。
就是以某个时间为标准,将一个表中的相应的数据插入到另一个表。
...全文
194 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
clubsondy 2006-08-23
  • 打赏
  • 举报
回复
差不多可以结贴了。谢谢大家的帮助。
clubsondy 2006-08-23
  • 打赏
  • 举报
回复
谢谢。解决了一些问题
wuguang007 2006-08-22
  • 打赏
  • 举报
回复
insert into tablename select * from tablename
lyatxt 2006-08-22
  • 打赏
  • 举报
回复



insert into 要插入的表 (列名1,列名2)select 列名1,列名2 from 源表
vfssqs 2006-08-22
  • 打赏
  • 举报
回复
不要需要注意的。如果用到了自增列的话,就要把字段一个一个的写出来.
xyxfly 2006-08-22
  • 打赏
  • 举报
回复
to:

字段好多的哦。

不是select * 吗 ^_^
dawugui 2006-08-22
  • 打赏
  • 举报
回复
insert into table select * from table2 where ......
clubsondy 2006-08-22
  • 打赏
  • 举报
回复
字段好多的哦。
i9988 2006-08-22
  • 打赏
  • 举报
回复
insert tb
select * from ta a
where 时间限制条件
and not exists (
select 1 from tb
where 主键=a.主键
)

achongsky 2006-08-22
  • 打赏
  • 举报
回复
insert tableA
select *
from tableB
where 时间>你定的那时间
fcuandy 2006-08-22
  • 打赏
  • 举报
回复
insert tb (字段列表) select 字段列表 from ta where 要插的条件

34,576

社区成员

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

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